返回主页

最小公倍数

常常和最大公约数配合使用

工具函数更新于 2026年8月19日 14:38#最小公倍数#数学
C++387 Bytes
下载文件
int lcm(int a, int b) {
    return a / gcd(a, b) * b;  // 先除后乘,防止溢出
}