Operate Numbers
CodeChefOpen on judge ↗
Ajay has two numbers $p$ and $q$, for passing the time he starts subtracting the smaller number from the bigger number and replacing the bigger number with the result. If both the numbers are equal he subtracts one from another. He keeps performing the operation until one number becomes zero. He wants to know the number of times subtraction took place before a number became zero. ###Input forma
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