問題一覧 > 通常問題

No.3555 Use Money Wisely

レベル : / AI推定難易度 : 77 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 1024 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 95
作問者 : butsurizuki / テスター : 👑 みうね fluorine TKTYI HoyHoyCharhang jastaway soryuusi0219 yaaya wasab1 tatesoto KumaTachiRen
お気に入りにしたユーザー ProblemId : 13382 / 自分の提出
問題文最終更新日: 2026-08-15 03:21:45
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
KCPC新歓杯2026 (順位表) の他の問題:

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.

SubtaskScoreConstraints
部分点120% (20 pts)$N=1$
部分点210% (10 pts)答えが red である
部分点330% (30 pts)答えが red でない
部分点440% (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もしくは右上の雲マークをクリックしてアカウントを作成してください。