Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- ll arr[200000];
- int main()
- {
- ll step,mod,i,j,k,a,b,c,d,e;
- while(cin>>step>>mod)
- {
- bool vis[mod+5]={false};
- ll x=0;
- arr[0]=(x+step)%mod;
- a=arr[0];
- i=1;
- while(true)
- {
- arr[i]=(arr[i-1]+step)%mod;
- vis[arr[i]]=true;
- if(arr[i]==a)
- break;
- i++;
- }
- ll fl=0;
- for(i=0;i<mod;i++)
- {
- if(vis[i]==false)
- {
- fl=1;
- break;
- }
- }
- if(fl==0)
- {
- printf("%10lld%10lld Good Choice\n",step,mod);
- cout<<endl;
- }
- else
- {
- printf("%10lld%10lld Bad Choice\n",step,mod);
- cout<<endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement