1. 程式人生 > >BZOJ5105: [CodePlus2017]晨跑

BZOJ5105: [CodePlus2017]晨跑

scan geo body -s tex ble zoj std 參考

【傳送門: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]晨跑