J - Good Coins
所以给定两个大小的硬币应用加减拼凑出所有大小的硬币。
有了一就可以有一切哦
#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; }
所以给定两个大小的硬币应用加减拼凑出所有大小的硬币。
有了一就可以有一切哦
#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; }