← All problemsSign in

Remove Stones

CodeChefRating 2968Open on judge ↗

**This is an interactive problem.** Alice and Bob are going to play a game, whose rules are as follows: They have a pile of $N$ stones, and an integer $K$. Alice and Bob take turns playing, with Alice going first. On their turn, a player must do the following: - Choose an integer $x$ such that $\gcd(x, K) = 1$, and there are at least $x$ stones remaining in the pile. Then, remove $x$ stones

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