Ring around the Chairs
CodeChefOpen on judge ↗
There are $N$ chairs arranged in a circle. Unfortunately, you are currently seated $D$ distance away (Clockwise) from your favorite chair. In one move, you can move to the chair That is $M$ chairs away (Clockwise direction) from your chair. Your task is to determine if it possible for you to be seated at Your favorite chair in a finite number of steps. You should output `"YES"` if possible and `"
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