Advertisement
Farjana_akter

Untitled

Apr 15th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4.  
  5. ll arr[200000];
  6. int main()
  7. {
  8. ll step,mod,i,j,k,a,b,c,d,e;
  9. while(cin>>step>>mod)
  10. {
  11. bool vis[mod+5]={false};
  12. ll x=0;
  13. arr[0]=(x+step)%mod;
  14. a=arr[0];
  15. i=1;
  16. while(true)
  17. {
  18. arr[i]=(arr[i-1]+step)%mod;
  19. vis[arr[i]]=true;
  20. if(arr[i]==a)
  21. break;
  22. i++;
  23. }
  24. ll fl=0;
  25. for(i=0;i<mod;i++)
  26. {
  27. if(vis[i]==false)
  28. {
  29. fl=1;
  30. break;
  31. }
  32. }
  33. if(fl==0)
  34. {
  35. printf("%10lld%10lld Good Choice\n",step,mod);
  36. cout<<endl;
  37. }
  38. else
  39. {
  40. printf("%10lld%10lld Bad Choice\n",step,mod);
  41. cout<<endl;
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement