import sys
for line in sys.stdin:
a = line.split("\n")[0].split(" ")
a0,a1 = int(a[0]),int(a[1])
if a0 % a1 ==0 or a1 % a0==0:
print(max(a0,a1))
else:
temp = a0*a1
if temp %2 == 0:
while temp/2 % a0 == 0 and temp/2 % a1 == 0:
temp = temp/2
print(int(temp))
elif temp %3 == 0:
while temp/3 % a0 == 0 and temp/3 % a1 == 0:
temp = temp/3
print(int(temp))
else:
print(temp)
如果最大的那个能直接当作最下公倍数
那么就能直接用
但是如果不行,那么就先相乘
然后不断%2 %3 直到最小为止,那么最小的那个就是目标

京公网安备 11010502036488号