No.3654 Cup Ramen
問題文最終更新日: 2026-08-30 13:37:47
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
MMA Contest 022
(順位表)
の他の問題:
Problem Statement
There are $N$ cups of instant ramen. The $i$-th cup requires $A_i$ mL of hot water to be poured in order to be completed.
You have a kettle for pouring hot water, and the kettle currently contains $X$ mL of hot water.
Find the amount of hot water, in mL, that you should add to the kettle in order to complete all the cups of ramen. The capacity of the kettle is sufficiently large, and no hot water is lost through evaporation or the like.
Constraints
- $1 \le N \le 100$
- $0 \le X \le 10000$
- $0 \le A_i \le 1000$
- All inputs are integers.
Input
$N\ X$ $A_1\ A_2\ A_3\ \dots \ A_N$
Output
Output the answer as a number without a unit on one line, followed by a newline.
Sample
Sample 1
Input
3 400 300 300 500
Output
700The total amount of hot water needed is $1100$ mL. Therefore, adding $700$ mL of hot water to the kettle is sufficient.
Sample 2
Input
1 1000 400
Output
0
There is no need to add more hot water.
Sample 3
Input
7 926 314 159 265 358 979 323 846
Output
2318
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
sepa38
くらげ