Square Game
CodeChefOpen on judge ↗
Shaw is a $16$ years old boy. He plays an interesting game every day. This game is played with two objects(variables) $A$ and $B$. Initially $A=B=0$. Shaw makes an arbitrary number of moves. In each move, he must perform the following operations: Choose any positive integer $X$ such that $X.X \gt B$. - Change $A$ to $X$. - Add $X.X$ to $B$. But shaw has a bad memory and he has forgotten the m
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