Decide the Winner
CodeChefOpen on judge ↗
$Alice$ and $Bob$ were fond of playing. One day, $Alice$ came up with a game of power of two. The game is as follows: 1. $Alice$ starts the game. 2. $Bob$ gives Alice a number. 3. If the number is a power of $2$, divide it by $2$ and change the turn, else subtract the highest power of $2$ and change the turn. 4. Continue until $1$ is left. The person who cannot move further $loses$ the game.
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.
Sign in to chat with the tutor and save your progress.
Sign in to start