#P1043A. Elections
Elections
Elections
题面翻译
有两个人小A和小B参加选举,共有n个人参与投票,每人可以投k票。小A通过暗箱操作知道了每个人一定会投ai票给小B。 他很想赢,所以决定通过操作来改变每个人可以投的票数k。问k最小为多少时,小A能获胜。
输入:第一行,包含一个整数n,投票的人数。 第二行,n个整数ai,ai为第i个人投给小B的票数。
输出:仅一行,包含一个整数k,每个人可投的票数。
题目描述
Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are students in the school. Each student has exactly votes and is obligated to use all of them. So Awruk knows that if a person gives votes for Elodreip, than he will get exactly votes from this person. Of course holds.
Awruk knows that if he loses his life is over. He has been speaking a lot with his friends and now he knows — how many votes for Elodreip each student wants to give. Now he wants to change the number to win the elections. Of course he knows that bigger means bigger chance that somebody may notice that he has changed something and then he will be disqualified.
So, Awruk knows — how many votes each student will give to his opponent. Help him select the smallest winning number . In order to win, Awruk needs to get strictly more votes than Elodreip.
输入格式
The first line contains integer ( ) — the number of students in the school.
The second line contains integers ( ) — the number of votes each student gives to Elodreip.
输出格式
Output the smallest integer ( ) which gives Awruk the victory. In order to win, Awruk needs to get strictly more votes than Elodreip.
样例 #1
样例输入 #1
5
1 1 1 5 1
样例输出 #1
5
样例 #2
样例输入 #2
5
2 2 3 2 2
样例输出 #2
5
提示
In the first example, Elodreip gets votes. The smallest possible is (it surely can't be less due to the fourth person), and it leads to votes for Awruk, which is enough to win.
In the second example, Elodreip gets votes. If , Awruk gets votes and loses to Elodreip.