Parsec to Planck
CodeChefOpen on judge ↗
There are 2020 people standing in a circle numbered 1-2020. Whoever has the weapon kills the $n^{th}$ person in front of him and gives the weapon to the $n+1^{th}$ person in front, that is, if 1 has the weapon and no one is killed yet he kills $1+n$ and gives the weapon to $2+n$. Find out who is the last one to be alive. ###Input Format The only line of input contains the integer $n$.
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