← All problemsSign in

Alice and Bob Play a Game

Alice challenges Bob to a game of Nimtraction. The game has the following rules: 1. Game starts with $n$ piles of matches with $a_1, a_2, \ldots ,a_n$ matches in each and a number $k$. 2. In each turn a player can choose to either remove any number of matches from one of the piles or subtract at most $z$ from the number $k$. 3. The game continues with the modified setup. It ends when $k$ becomes $

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