https://www.codetree.ai/missions/5/problems/find-the-least-common-multiple/description
코드트리 | 코딩테스트 준비를 위한 알고리즘 정석
국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.
www.codetree.ai
import sys
input = sys.stdin.readline
a, b = map(int, input().split(" "))
def gcd(a,b):
while b > 0:
a, b = b , a % b
return a
def lcm(a, b):
return int(a*b / gcd(a, b))
print(lcm(a, b))
728x90
반응형
'🔻PS > Codetree' 카테고리의 다른 글
[Codetree] 모이자 Python (0) | 2024.08.04 |
---|---|
[Codetree] 이동경로상에 있는 모든 숫자 더하기 Python (0) | 2024.07.31 |
[Codetree] 되돌아오기 2 Python (0) | 2024.07.29 |
[Codetree] 되돌아오기 Python (0) | 2024.07.29 |
[Codetree] 빙빙 돌며 숫자 사각형 채우기 Python (0) | 2024.07.29 |