1. 程式人生 > >【51NOD-0】1011 最大公約數GCD

【51NOD-0】1011 最大公約數GCD

style lose gif lap blog %d 51nod ret display

【算法】歐幾裏德算法

技術分享
#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("%d",gcd(a,b));
    return 0;
}
View Code

【51NOD-0】1011 最大公約數GCD