Cube Game
CodeChefOpen on judge ↗
R2D2 and BB8 love playing together and this time BB8 came up with a new game to try. BB8 creates two piles of $a$ ,respectively $b$ cubes and he sets a number $x$. The game goes as follows: 1. The players move alternatively. At their move , a player chooses a number $k$ and takes $k*x$ cubes from a pile and puts $k*(x-1)$ cubes in the other one. The number $k$ is chosen by the player such that t
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