http://acm.hdu.edu.cn/showproblem.php?pid=2104
最大公约数=1是YES
View Code
1 #include <stdio.h>
2 int gcd(int x,int y)
3 {
4 return y==0?x:gcd(y,x%y);
5 }
6 int main()
7 {
8 int m,n;
9 while (scanf("%d%d",&m,&n) && m!=-1 && n!=-1)
10 if (gcd(m,n)>1) printf("POOR Haha\n");
11 else printf("YES\n");
12 }