PaycomOA #2
Q2. Pseudo Code — Mystery Algorithm
EasyConcept questionJudge-ready
Topics (AI-labelled)Bits & Math
The original problem gives pseudocode for repeated subtraction and asks for the result when a=2437, b=875. This site generalizes the same algorithm to read any two positive integers and output x=y at the point where the algorithm terminates.
Input
One line with two positive integers a, b. Ranges added by this site: 1≤a,b≤10^9.
Output
Output the equal value that this repeated-subtraction algorithm ends with.
Example 1
Input:
2437 875
Output:
1
Example 2
Input:
12 18
Output:
6
Example 3
Input:
1 999999
Output:
1
Editorial
Loading solution…