QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100

#76. ピアニスト

Statistiques

あるピアニストがピアノを弾こうとしています。

ピアノには $10^{100}$ 個の鍵盤があり、左から右へ $A,B,C,D,E,F,G,A,B,\ldots$ とラベルが付いています。ピアニストは次の条件を満たそうとしています。

  • $A$ の鍵盤を一つ選び、その鍵盤を押して演奏を始めます。
  • $i$ 番目の鍵盤を押した後、次の手順では $i-1$ 番目または $i+1$ 番目の鍵盤を押すことができます。
  • $A$ の鍵盤を押した後は、演奏を終えることもできます。
  • 最初に弾く $A$ の鍵盤と最後に弾く $A$ の鍵盤は、同じである必要はありません。
  • $A$ の鍵盤を(どの $A$ の鍵盤かにかかわらず)ちょうど $C_1$ 回押さなければなりません。
  • 同様に、$B,C,D,E,F,G$ の鍵盤を、それぞれちょうど $C_2,\ldots,C_7$ 回押さなければなりません。

上のすべての条件を満たすことが可能かどうかを判定してください。

入力

$C_1\ C_2\ C_3\ C_4\ C_5\ C_6\ C_7$

  • $0 \le C_i \le 10^{10}$
  • $\sum C_i > 0$

出力

すべての条件を満たすことが可能ならば YES を、そうでなければ NO を出力してください。

入出力例

入力 1

2 1 1 1 1 1 1

出力 1

YES

入力 2

1 1 1 1 1 1 1

出力 2

NO

入力 3

3 1 0 10000000000 10000000000 0 1

出力 3

NO

入力 4

1 0 0 0 0 0 0

出力 4

YES

注記

入出力例 1 では、$A,B,C,D,E,F,G,A$ の順に弾くことができます。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.