【杭电ACM】1.2.3 hide handkerchief
1 #include2 using namespace std; 3 4 int gcd(int a, int b){ 5 if(b == 0) 6 return a; 7 return gcd(b, a % b); 8 } 9 10 bool relativelyPrime(int a, int b){11 if(gcd(a, b) == 1)12 return true;13 else14 return false;15 }16 int main(){17 int n, m;18 while(cin >> n >> m){19 if(n == -1 && m == -1)20 break;21 if(relativelyPrime(n , m))22 cout << "YES" << endl;23 else24 cout << "POOR Haha" << endl;25 }26 return 0;27 }