https://www.acmicpc.net/problem/1934
두 수 a, b가 있을 때, a와 b의 최소공배수는 a * b / GCD(a, b)로 구할 수 있다. 여기서 최대공약수 GCD는 유클리드 호제법을 통해 간단히 구할 수 있다.
import sys
def get_gcd(a: int, b: int) -> int:
if a < b:
return get_gcd(b, a)
if b == 0:
return a
else:
return get_gcd(b, a%b)
def solution(a: int, b: int):
return print(int(a * b / get_gcd(a, b)))
for _ in range(int(input())):
a, b = map(int, sys.stdin.readline().split())
solution(a, b)