Advertisement
Saleh127

UVA 408

Oct 12th, 2020 (edited)
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll stp,mod;
  11. while(cin>>stp>>mod)
  12. {
  13. ll i,j,k,l,c=0,d;
  14. bool a[mod]={0},x=false;
  15. for(i=0;i<mod;i++)
  16. {
  17. d=(c+stp)%mod;
  18. if(a[d]==true)
  19. {
  20. x=true;
  21. break;
  22. }
  23. a[d]=true;
  24. c=d;
  25. }
  26. ///if __gcd(stp,mod)==1 then good else Bad choice
  27. if(x) printf("%10lld%10lld Bad Choice\n\n",stp,mod);
  28. else printf("%10lld%10lld Good Choice\n\n",stp,mod);
  29. }
  30.  
  31.  
  32. return 0;
  33. }
  34.  
Advertisement
RAW Paste Data Copied
Advertisement