問題一覧 > 通常問題

No.524 Coin Game

レベル : / AI推定難易度 : 900 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 64 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 254
作問者 : hirakich1048576 / テスター : Nafmo2
お気に入りにしたユーザー ProblemId : 1091 / 自分の提出
問題文最終更新日: 2026-06-25 08:08:13
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 165 (順位表) の他の問題:

Problem Statement

You had a dream.
It was a dream in which your pet dog Chiwawa was kidnapped by the Demon King Yekocidur.
To save Chiwawa, you went through many adventures and finally defeated the Demon King Yekocidur.
However, he was defeated so easily that you felt suspicious, and as you searched for Chiwawa,
you found that Chiwawa had somehow ended up in a terrible state.
Next to Chiwawa are several plates with coins on them.
It seems that Chiwawa will return to normal if you win a game played with them.
The rules of this game are as follows.

  • You move first and Chiwawa moves second, and you take coins alternately.
  • You may take any number of coins at a time, but on each turn all of them must be taken from the same plate.
  • You must always take at least 1 coin.
  • A player whose turn comes when there are no coins left loses. The game ends, and the player who did not lose wins.
There are \(N\) plates, and the \(i \)-th (1-indexed) plate has \(i\) coins on it.
Given \(N\), determine whether you will win.
Here, both players always play optimally in order to win.

Input

N

The value of the integer N ( \( 0 < N < 2^{32}\) ) is given on one line.

Output

Print "O" if you win, or "X" if Chiwawa wins, on one line (without the quotation marks). Do not forget the newline at the end.

Sample

Sample 1
Input
3
Output
X

The numbers of coins on the plates are [1, 2, 3]. Unfortunately, in this case Chiwawa will not return to normal. Let us hope for a miracle.

Sample 2
Input
788
Output
O

Sample 3
Input
33554432
Output
O

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。