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;

}
}


原文地址:https://www.cnblogs.com/mingrigongchang/p/6246333.html