题解 | #求最小公倍数#

求最小公倍数

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

if __name__ == '__main__':
    A, B = list(map(int, input().strip().split()))
    # 求最大公约数
    x = min(A, B)
    while x > 1:
        if A % x == 0 and B % x == 0:
            break
        x -= 1
    ans = (A * B) // x
    print(ans)

全部评论

相关推荐

码农索隆:单休一个月少休息4天,一年就是48天,平时节假日,别人3天假期,单休的两天
点赞 评论 收藏
分享
06-02 15:53
阳光学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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