← All problemsSign in

Sereja and Game

CodeChefRating 2469Open on judge ↗

Sereja and Dima play the game. The rules are as follows: Initially, there are n cards on the table, each card has a positive integer written on it. At the beginning Sereja writes down the number 0 on the sheet of paper. Then players pick cards from the table alternately. When a player picks a card, he writes down the greatest common divisor of a number that is written on a card and a number that

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