题解 | #求最小公倍数#

求最小公倍数

https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3

import math
a,b=map(int,input().split(' '))
x=max(a,b)
n=min(a,b)
t=0
if x%n==0:
    print(x)
    t=1
else:
    for i in range(1,n):
        if (x*i)%n==0:
            print(x*i)
            t=1
            break
if t==0:
    print(x*n)
        

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务