The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends.
Now I introduce the game to you. Suppose there are N people played the game ,who sit on the ground forming a circle ,everyone owns a box behind them .Also there is a beautiful handkerchief hid in a box which is one of the boxes .
Then Haha(a friend of mine) is called to find the handkerchief. But he has a strange habi
【杭电ACM】1.2.3 hide handkerchief
http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=2&problemid=6
1 #include <iostream>
2 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 else
14 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 else
24 cout << "POOR Haha" << endl;
25 }
26 return 0;
27 }