← All problemsSign in

Add 1 or 2 Game

CodeChefRating 1030Open on judge ↗

Alice and Bob play a game. There is an integer $X$, which is initially $0$. On their turn, Alice or Bob can choose to increment $X$ by either $1$ or $2$. The game ends as soon as $X \ge N$ holds. When the game ends, Bob wins the game if $X = N$, otherwise Alice wins the game. Alice goes first, and the players alternate turns. If both players play optimally, predict the winner. ### Input -

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start