No.680 Numbers That Can Be Made
問題文最終更新日: 2026-06-26 01:25:28
English (AI translation)
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 189
(順位表)
の他の問題:
Problem Statement
Yuki came up with the following "way of making a number".
- Step 1: Initially, let $s=0, t=0$.
- Step 2: Double the value of $t$ and make it the new value of $t$ ($t := t \times 2$).
- Step 3: Toss a coin in your mind. If it comes up heads, add $1$ to the value of $t$ and make it the new value of $t$ ($t := t+1$). You may decide whether the coin comes up heads as is convenient for you.
- Step 4: Add the value of $t$ to the value of $s$ and make it the new value of $s$ ($s := s+t$).
- Step 5: Roll a die in your mind. If it shows a face other than $1$, return to Step 2. You may decide the result of the die roll as is convenient for you.
- Step 6: Output the value of $s$ as the number made, and terminate.
Output YES if it can be made, and NO if it cannot.
Input
$N$
$0 \le N \le 1000000000=10^9$
$N$ is an integer.
Output
Output YES or NO.
Sample
Sample 1
Input
10
Output
YES
We have $10=1+3+6$. Therefore, by tossing the coin suitably in Step 3 so that the values of $t$ at Step 4 are $1, 3, 6$, you can make $10$.
Sample 2
Input
12
Output
NO
It seems that $12$ cannot be made no matter what you do.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
tails
はむこ