/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.051 MiB

Code

T = int(input())
results = []

for _ in range(T):
    A, B = map(int, input().split())
    operations = 0

    while A != 0 and B != 0:
        if A > B:
            operations += A // B
            A %= B
        else:
            operations += B // A
            B %= A

    results.append(str(operations))

print("\n".join(results))

Information

Submit By
Type
Pretest
Problem
P1029 Make it zero
Language
Python 3 (Python 3.12.3)
Submit At
2024-11-05 21:25:38
Judged At
2024-11-11 02:25:31
Judged By
Score
10
Total Time
15ms
Peak Memory
3.051 MiB