Python-最大公约数/最小公倍数
摘要:1 def gcd(x,y): 2 '''求最大公约数''' 3 if x>y: 4 m,n=x,y 5 else: 6 m,n=y,x 7 while m % n: 8 m,n = n, m%n 9 return n 10 11 def lcm(x,y): 12 '''求最小公倍数''' 13 r
阅读全文
posted @ 2021-08-01 20:08
posted @ 2021-08-01 20:08
posted @ 2021-08-01 10:38