백준 2606 최대공약수와 최소공배수

김지하·2021년 3월 18일

알고리즘

목록 보기
5/5
post-thumbnail

백준 2606

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

def gcd(a,b):
    while b:
        a,b = b, a % b
    return a

print(gcd(a,b))

def lcm(a,b):
    return (a*b//gcd(a, b))
print(lcm(a,b))
profile
기발하게 개발하자

0개의 댓글