码迷,mamicode.com
首页 > 其他好文 > 详细

BZOJ5105: [CodePlus2017]晨跑

时间:2018-03-08 21:38:09      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:最小公倍数   ble   enter   code   ==   get   传送门   ref   type   

【传送门: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\n",c*(a*b/t)/gcd(c,(a*b/t)));
    return 0;
}

 

BZOJ5105: [CodePlus2017]晨跑

标签:最小公倍数   ble   enter   code   ==   get   传送门   ref   type   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!