問題一覧 > 通常問題

No.1462 Weakest WEAKER

レベル : / AI推定難易度 : 500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 233
作問者 : wolgnik / テスター : Kanten4205
お気に入りにしたユーザー ProblemId : 4840 / 自分の提出
問題文最終更新日: 2020-07-30 18:37:40
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 289 (Kanten4205’s Birthday Contest) (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。