問題一覧 > 通常問題

No.842 Hatsumode (First Shrine Visit of the Year)

レベル : / AI推定難易度 : 180 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 338
作問者 : sifue / テスター : Maitneel
お気に入りにしたユーザー ProblemId : 2677 / 自分の提出
問題文最終更新日: 2020-11-03 00:20:25
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
yukicoder contest 216 (順位表) の他の問題:

Problem Statement

Yasuo, a male high school student, has invited Morgana-senpai, a female high school student, to go on a New Year's shrine visit (hatsumode). Upon arriving at the shrine, Morgana-senpai said, "If you can offer exactly the amount I name using coins, I'll go out with you." Yasuo checks his coin purse.

The coins Yasuo has are given as $A$ 500-yen coins, $B$ 100-yen coins, $C$ 50-yen coins, $D$ 10-yen coins, $E$ 5-yen coins, and $F$ 1-yen coins, and the offering amount Morgana-senpai demands is given as $G$ yen.

Output YES if Yasuo can succeed in making the offering at the shrine visit and go out with Morgana-senpai, and NO otherwise.

Input

$A$ $B$ $C$ $D$ $E$ $F$ $G$

$0 \leqq A \leqq 10 $
$0 \leqq B \leqq 10 $
$0 \leqq C \leqq 10 $
$0 \leqq D \leqq 10 $
$0 \leqq E \leqq 10 $
$0 \leqq F \leqq 10 $
$1 \leqq G \leqq 5000$

Output

Output YES or NO, followed by a newline.

Sample

Sample 1
Input
0 0 0 0 0 1 1
Output
YES

An offering of 1 yen can be made with one 1-yen coin.

Sample 2
Input
0 0 2 0 1 9 114
Output
YES

An offering of 114 yen can be made with two 50-yen coins, one 5-yen coin, and nine 1-yen coins.

Sample 3
Input
0 0 2 0 1 8 114
Output
NO

An offering of 114 yen cannot be made.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。