bzoj5105: [CodePlus2017]晨跑(LCM)

5105: [CodePlus2017]晨跑

题目:传送门


题解:

   没有很懂Code Puls 的操作...一道签到的三个数的LCM???


代码:

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<cstdlib>
 4 #include<cmath>
 5 #include<algorithm>
 6 using namespace std;
 7 typedef long long LL;
 8 LL a,b,c;
 9 LL gcd(LL a,LL b)
10 {
11     if(a==0)return b;
12     else return gcd(b%a,a);
13 }
14 int main()
15 {
16     scanf("%lld%lld%lld",&a,&b,&c);
17     a=a*b/gcd(a,b);
18     a=a*c/gcd(a,c);
19     printf("%lld
",a);
20     return 0;
21 }
原文地址:https://www.cnblogs.com/CHerish_OI/p/8537359.html