HDU 2104 hide handkerchief

一道水题,判断N和M互不互质就行了,如果不互质,有些人Haha是不能查询的

#include <iostream>

using namespace std;

int main()
{
    int N,M,tem;

    while(cin>>N>>M){
        if(N==-1&&M==-1)

            break;

    while(N%M!=0){
    tem = N%M;
    N=M;
    M = tem;

    }
    if(M==1)
        cout<<"YES"<<endl;
    else
        cout<<"POOR Haha"<<endl;

}
}


posted @ 2016-04-09 21:14  Lawliet__zmz  阅读(119)  评论(0编辑  收藏  举报