码迷,mamicode.com
首页 > 其他好文 > 详细

CF w1d2 A. Superhero Transformation

时间:2020-04-10 00:19:28      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:power   error   ini   maximum   red   elements   code   false   pac   

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;
}

CF w1d2 A. Superhero Transformation

标签:power   error   ini   maximum   red   elements   code   false   pac   

原文地址:https://www.cnblogs.com/LiangYC1021/p/12670484.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!