SDUT J - Good Coins(Gym 101020J)


SDUT J - Good Coins(Gym 101020J)_第1张图片

#include 
#include 
#include 
using namespace std;
int main()
{
     
    int t,a,b,k;
    cin>>t;
    while (t--)
    {
     
        cin>>a>>b;
        if (a<b)
        {
     
            k=a;
            a=b;
            b=k;
        }
        int c=a%b;
        while(1)
        {
     
            if(c==0)
            {
     
                cout<<"NOT GOOD"<<endl;
                break;
            }
            if(c==1)
            {
     
                cout<<"GOOD"<<endl;
                break;
            }
            a=b;
            b=c;
            c=a%b;
        }
    }
    return 0;
}

你可能感兴趣的:(SDUT J - Good Coins(Gym 101020J))