J - Good Coins - (互素充要ax+by=1)

J - Good Coins

 Gym - 101020J

所以给定两个大小的硬币应用加减拼凑出所有大小的硬币。

有了一就可以有一切哦

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,m;
    cin>>t;
    while(t--)
    {
        cin>>n>>m;
        if(__gcd(m,n)==1)
            cout<<"GOOD"<<endl;
        else
            cout<<"NOT GOOD"<<endl;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/BePosit/article/details/81358939