Find Position after N steps
CodeChefOpen on judge ↗
Given a 2-D Cartesian plane. Initially, you are at $(0,0)$ position. Now, you are asked to perform $N$ steps. For each $i = 1\rightarrow N$, you do the following: - If $i$ is odd, you move $i$ positions towards the right. Formally, if you are currently at position $(a, b)$, you move to $(a+i,b).$ - If $i$ is even, you move $i$ position upwards. Formally, if you are currently at position $(a, b)$,
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