[최소공배수]-1934번
My answer
import sys
n=int(input())
for i in range(n):
a,b=map(int,sys.stdin.readline().split())
c=a*b
while(b!=0):
if(b>a): a,b=b,a
a=a%b
a,b=b,a
print(c//a)
Another answer
import math
for _ in[0]*int(input()):
print(math.lcm(*map(int,input().split())))
728x90
반응형
'코딩테스트 > 백준[Python]' 카테고리의 다른 글
[Python/백준] #9613- [GCD 합] (0) | 2021.12.04 |
---|---|
[Python/백준] #1850- [최대공약수] (0) | 2021.12.04 |
[Python/백준] #1158- [요세푸스 문제] (0) | 2021.12.04 |
[Python/백준] #1406- [에디터] [try_again] (0) | 2021.12.03 |
[Python/백준] #11656- [접미사 배열] (0) | 2021.12.02 |