传统题 1000ms 256MiB

D - Hachi

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

D - Hachi

Score : $400$ points

Problem Statement

Given is a digit sequence $S$ consisting of the digits from 1 through 9.

Takahashi, the bee, loves multiples of $8$.

He is trying to make a multiple of $8$ by permuting the digit sequence $S$.

Determine whether it is possible.

Constraints

  • $1 \leq |S| \leq 2 \times 10^5$
  • Each character of $S$ is one of the digits from 1 through 9.

Input

Input is given from Standard Input in the following format:

SS

Output

If it is possible to make a multiple of $8$ by permuting the digit sequence $S$, print Yes; otherwise, print No.


1234
Yes

For example, permuting $1234$ into $1432$ results in a multiple of $8$.


1333
No

There is no way to permute $1333$ into a multiple of $8$.


8
Yes

2024春季入门组刷题营(十一)

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-5-26 13:00
结束于
2024-5-26 15:00
持续时间
2 小时
主持人
参赛人数
10