【51NOD-0】1012 最小公倍数LCM

【算法】欧几里德算法

#include<cstdio>
int gcd(int a,int b)
{return b==0?a:gcd(b,a%b);}
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%lld",1ll*a*b/gcd(a,b));
    return 0;
}
View Code

 

posted @ 2017-05-26 19:05  ONION_CYC  阅读(180)  评论(0编辑  收藏  举报