No.3555 Use Money Wisely
タグ : / 解いたユーザー数 95
作問者 :
butsurizuki
/ テスター :
👑
jastaway
yaaya
Problem Statement
One day, KCPC received an income of $Y$ yen. At this point, KCPC's remaining budget is also $Y$ yen.
KCPC spent this budget on $N$ events. Specifically, it spent $A_i$ yen of the budget on the $i$-th event.
How much of the budget remains after all the events have ended?
However, if there is a deficit, that is, if the total amount spent is strictly greater than $Y$ yen, print red instead.
Input
The input is given from Standard Input in the following format.
$Y$ $N$ $A_1$ $A_2$ $\dots$ $A_N$
- $1 \le Y \le 10^9$
- $1 \le N \le 100$
- $1 \le A_i \le 10^7$
- All input values are integers.
Partial Score
This problem has partial scoring based on subtasks.
| Subtask | Score | Constraints |
|---|---|---|
| 部分点1 | 20% (20 pts) | $N=1$ |
| 部分点2 | 10% (10 pts) | 答えが red である |
| 部分点3 | 30% (30 pts) | 答えが red でない |
| 部分点4 | 40% (40 pts) | 追加の制約はない |
Output
Print the answer on $1$ line.
Sample
Sample 1
Input
10000 1 8500
Output
1500
The budget is initially $10000$ yen, and after spending $8500$ yen, $1500$ yen remains.
Sample 2
Input
15000 2 9000 8000
Output
red
The budget is initially $15000$ yen, but a total of $9000+8000=17000$ yen is spent, resulting in a deficit. Therefore, print red.
Sample 3
Input
1000000000 3 10000000 10000000 9999999
Output
970000001
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。