QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100

#76. 钢琴家

Statistics

一位钢琴家想要弹奏钢琴。 这架钢琴有 $10^{100}$ 个琴键,从左到右依次标记为 $A, B, C, D, E, F, G, A, B, \dots$。 钢琴家想要满足以下限制条件:

  • 他选择一个 $A$ 键,并按下该键开始弹奏。
  • 在他按下第 $i$ 个键后,下一步他可以按下第 $i-1$ 个键或第 $i+1$ 个键。
  • 在他按下一个 $A$ 键后,他也可以停止弹奏。
  • 他弹奏的第一个键和最后一个键必须都是 $A$ 键。
  • 他必须恰好按下 $A$ 键 $C_1$ 次(具体是哪几个 $A$ 键并不重要)。
  • 同样地,他必须分别恰好按下 $B, C, D, E, F, G$ 键 $C_2, \dots, 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.