atcoder#ARC159B. [ARC159B] GCD Subtraction
[ARC159B] GCD Subtraction
Score : points
Problem Statement
We have variables and . Initially, and .
Takahashi will repeat the following operation while both and are greater than or equal to .
- Let be the greatest common divisor of and , and replace and with and , respectively.
How many times will he perform the operation?
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
15 9
2
We start with and perform the following.
- Let , and replace and with and , respectively.
- Let , and replace and with and , respectively. is no longer greater than or equal to , so the iteration terminates.
1 1
1
12345678910 10987654321
36135