/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 16ms 3.07 MiB
#2 Accepted 16ms 3.008 MiB
#3 Accepted 19ms 3.172 MiB
#4 Accepted 19ms 3.039 MiB
#5 Accepted 21ms 3.066 MiB
#6 Accepted 21ms 3.043 MiB
#7 Accepted 21ms 3.023 MiB
#8 Accepted 19ms 3.07 MiB
#9 Accepted 25ms 3.121 MiB
#10 Accepted 23ms 3.223 MiB
#11 Accepted 20ms 3.062 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
Submission
Problem
P1029 Make it zero
Language
Python 3 (Python 3.12.3)
Submit At
2024-11-05 21:26:20
Judged At
2024-11-11 02:25:30
Judged By
Score
100
Total Time
25ms
Peak Memory
3.223 MiB