103130: [Atcoder]ABC313 A - To Be Saikyo
Description
Score : $100$ points
Problem Statement
There are $N$ people numbered $1$ through $N$. Each person has a integer score called programming ability; person $i$'s programming ability is $P_i$ points. How many more points does person $1$ need, so that person $1$ becomes the strongest? In other words, what is the minimum non-negative integer $x$ such that $P_1 + x > P_i$ for all $i \neq 1$?
Constraints
- $1\leq N \leq 100$
- $1\leq P_i \leq 100$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $P_1$ $P_2$ $\dots$ $P_N$
Output
Print the answer as an integer.
Sample Input 1
4 5 15 2 10
Sample Output 1
11
Person $1$ becomes the strongest when their programming skill is $16$ points or more, so the answer is $16-5=11$.
Sample Input 2
4 15 5 2 10
Sample Output 2
0
Person $1$ is already the strongest, so no more programming skill is needed.
Sample Input 3
3 100 100 100
Sample Output 3
1
Output
得分:100分
问题描述
有N个人,编号为1到N。每个人都有一个叫做编程能力的整数得分;第i个人的编程能力是P_i分。第1个人需要多少分才能成为最强者?换句话说,求最小的非负整数x,使得对于所有i≠1,有P_1+x>P_i。
限制条件
- 1≤N≤100
- 1≤P_i≤100
- 所有的输入值都是整数。
输入
输入从标准输入按以下格式给出:
$N$ $P_1$ $P_2$ $\dots$ $P_N$
输出
以整数形式打印答案。
样例输入1
4 5 15 2 10
样例输出1
11
当第1个人的编程能力达到16分或更多时,他们将成为最强者,所以答案是16-5=11。
样例输入2
4 15 5 2 10
样例输出2
0
第1个人已经是最强者,所以不需要更多的编程能力。
样例输入3
3 100 100 100
样例输出3
1