No.1462 Weakest WEAKER
タグ : / 解いたユーザー数 233
作問者 :
wolgnik
/ テスター :
Problem Statement
You and your bosom friend woLgniK are playing with stones. The rules are as follows.
Initially, there are $N$ stones on the field. Let $X$ be the current number of stones on the field. On each of their turns, a player chooses an integer $k$ such that $0≦k,3^k≦X$ and performs one operation of removing exactly $3^k$ stones from the field. Starting with you, you and woLgnik alternately repeat this operation, and the player who first becomes unable to perform the operation " wins ".
If both players play optimally, can you win?
Input
$N$
$1\leq N\leq 10^9$
All inputs are integers.
Output
If both players play optimally, print YES on one line if you win, or NO if you lose, followed by a newline at the end.
Sample
Sample 1
Input
2
Output
YES
First you take 1 stone, and then woLgnik takes 1 stone. Now you can no longer perform the operation, so you win.
Sample 2
Input
777
Output
NO
Sample 3
Input
999999999
Output
NO
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。