• CF w1d2 A. Superhero Transformation


    Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.

    Initially, there are n superheroes in avengers team having powers a1,a2,…,an, respectively. In one operation, they can remove one superhero from their team (if there are at least two) or they can increase the power of a superhero by 1. They can do at most m operations. Also, on a particular superhero at most k operations can be done.

    Can you help the avengers team to maximize the average power of their crew?

    Input

    The first line contains three integers n, k and m (1≤n≤105, 1≤k≤105, 1≤m≤107) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations.

    The second line contains n integers a1,a2,…,an (1≤ai≤106) — the initial powers of the superheroes in the cast of avengers.

    Output

    Output a single number — the maximum final average power.

    Your answer is considered correct if its absolute or relative error does not exceed 10−6.

    Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if |a−b|/max(1,|b|)≤10^−6.

    Examples

    input
    2 4 6
    4 7
    output
    11.00000000000000000000

    input
    4 2 6
    1 3 2 3
    output
    5.00000000000000000000

    Note

    In the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.

    In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by 2 each.

    #include<bits/stdc++.h>
    using namespace std;
    bool vowel(char ch)
    {
    	if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')return true;
    	else return false;
    }
    int main()
    {
    	int flag=1,len;
    	string s,t;
    	cin>>s>>t;
    	if(s.size()!=t.size())flag=0;
    	else for(int i=0;i<s.size();i++){
    		if(s[i]!=t[i]){
    			if(vowel(s[i])!=vowel(t[i])){
    				flag=0;
    				break;
    			}
    		}
    	}
    	if(flag)cout<<"Yes";
    	else cout<<"No";
    	return 0;
    }
    
  • 相关阅读:
    H5调用Android播放视频
    JavaScript调Java
    Java调用JavaScript
    python的下载和安装
    s5_day1作业
    s5_day2作业
    pycharm激活(转)
    for…else和while…else
    小练习
    09 grep、正则表达式和sed
  • 原文地址:https://www.cnblogs.com/LiangYC1021/p/12670484.html
Copyright © 2020-2023  润新知