Fun With Numbers
CodeChefOpen on judge ↗
Munchi and BlackHammer like to play games. BlackHammer gives Munchi 2 numbers N and M and allowes him to perform following operations on the numbers- - Subtract 1 from any one of the numbers. - Divide both the numbers by their gcd. Now, Munchi wants to know the minimum number of operations to convert (N,M) to (1,1). Input - First line contains T - Number of test cases. - Next T lines contain
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