原题链接:https://www.luogu.com.cn/problem/P4057
题意解读:给定三个数,计算其最小公倍数。
解题思路:
三个数a、b、c
lcm(a, b, c) = lcm(lcm(a, b), c)
100分代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL a, b, c;
LL gcd(LL a, LL b)
{
if(b == 0) return a;
return gcd(b, a % b);
}
LL lcm(LL a, LL b)
{
return a * b / gcd(a, b);
}
int main()
{
cin >> a >> b >> c;
cout << lcm(lcm(a, b), c);
}
标签:+#,Code,return,gcd,洛谷题,LL,long,P4057,lcm From: https://www.cnblogs.com/jcwy/p/18135840