AtCoder Beginner Contest 151
翻译中…
Problem Statement
翻译中…
Takahashi is taking exams on $N$ subjects. The score on each subject will be an integer between $0$ and $K$ (inclusive).
翻译中…
He has already taken exams on $N-1$ subjects and scored $A_i$ points on the $i$-th subject.
翻译中…
His goal is to achieve the average score of $M$ points or above on the $N$ subjects.
翻译中…
Print the minimum number of points Takahashi needs on the final subject to achieve his goal.
翻译中…
If the goal is unachievable, print -1 instead.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 100$$1 \leq K \leq 100$$1 \leq M \leq K$$0 \leq A_i \leq K$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K M
A_1 A_2 ... A_{N-1}
翻译中…
Output
翻译中…
Print the minimum number of points required on the final subject, or -1.
翻译中…
样例
Input #1
5 10 7
8 10 3 6
Output #1
8
If he scores $8$ points on the final subject, his average score will be $(8+10+3+6+8)/5 = 7$ points, which meets the goal.
Input #2
4 100 60
100 100 100
Output #2
0
Scoring $0$ points on the final subject still meets the goal.
Input #3
4 100 60
0 0 0
Output #3
-1
He can no longer meet the goal.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。