Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
66903 胡海峰老师 最大公约数和最小公倍数 Python3 Accepted 125 MS 3780 KB 427 2024-03-11 15:07:26

Tests(1/1):


Code:

a,b = list(map(int,input().split())) def max_common_divisor(x,y): if x<y: x,y = y,x t = y while t!=1: if x%t==0 and y%t==0: break t -=1 return t def min_product(a,b): t = max(a,b) while True: if t%a ==0 and t%b ==0: break t +=1 return t res1 = max_common_divisor(a,b) res2 = min_product(a,b) print(res1,res2)