hdoj1014

来源:互联网 发布:linux vi 滚动几行 编辑:程序博客网 时间:2024/05/20 10:14

为什么是两个数互质呢?直觉。。。

#include<cstdio>int gcd(int a,int b){if(a%b==0) return b;else return gcd(b,a%b);}int main(){int step,mod;while(scanf("%d %d",&step,&mod)!=EOF){printf("%10d%10d    ",step,mod);if(gcd(mod,step)==1) printf("Good Choice\n");else printf("Bad Choice\n"); printf("\n");}return 0;}


 

0 0
原创粉丝点击