#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
using namespace std;
int rp(int n,int m) //找出最大公因数
{
while(n!=m) //辗转相减法
{
if(n>m) n=n-m;
else m=m-n;
}
return n;
}
int main()
{
int n,m;
while((cin>>n>>m)&&(n!=-1||m!=-1))
{
int a=rp(n,m);
if(a==1) cout<<"YES"<<endl;
else cout<<"POOR Haha"<<endl;
}
return 0;
}
HDOJ2104(最大公因数)
最新推荐文章于 2020-12-24 20:18:09 发布