BZOJ5105: [CodePlus2017]晨跑

【传送门:BZOJ5105


简要题意:

  给出a,b,c,求a,b,c的最小公倍数


题解:

  直接搞(最近刷水题有点心态爆炸)


参考代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef long long LL;
LL gcd(LL a,LL b)
{
    if(a==0) return b;
    else return gcd(b%a,a);
}
int main()
{
    LL a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    LL t=gcd(a,b);
    printf("%lld
",c*(a*b/t)/gcd(c,(a*b/t)));
    return 0;
}

 

原文地址:https://www.cnblogs.com/Never-mind/p/8530920.html