본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 9924번 The Euclidean Algorithm

by 현장 2025. 3. 12.

-Code

a, b = map(int, input().split())
cnt = 0

while a != b:
    if a > b:
        a -= b
    else:
        b -= a
    cnt += 1
print(cnt)