题解 | #求最小公倍数#
求最小公倍数
https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
逻辑:两个数的乘积等于两个数的最大公因数和最小公倍数的乘积
import math
def gcd(a,b)
return math.gcd(a,b)
a,b=map(int,input().split())
print(int(a*b/gcd(a,b)))
求最小公倍数
https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
逻辑:两个数的乘积等于两个数的最大公因数和最小公倍数的乘积
import math
def gcd(a,b)
return math.gcd(a,b)
a,b=map(int,input().split())
print(int(a*b/gcd(a,b)))
相关推荐