#include<stdio.h>
int gcd(int a,int b){//(14,49)(49,14)(14,7)
while(b){//b=49 b=14 b=7 b=0
int t=a%b;//t=14 t=7 t=0
a=b;//a=49 a=14 a=7
b=t;//b=14 b=7 b=0
}
return a;//a=7
}
int main(){
int a,b;
while(~scanf("%d%d",&a,&b))//a=14 b=49
printf("%d\n",gcd(a,b));//7
return 0;
}
九度OJ最大公约数1056
最新推荐文章于 2023-09-29 12:28:23 发布