fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include<bits/stdc++.h>
  3. #include<unordered_map>
  4. using namespace std;
  5. typedef long long ll;
  6. typedef unsigned long long ull;
  7. typedef long double ld;
  8. typedef vector<int> vi;
  9. #define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  10. #define endl '\n'
  11. #define sz(s) (int)(s.size())
  12. #define all(s) s.begin(),s.end()
  13. #define allr(s) s.rbegin(),s.rend()
  14. #define RT(s) return cout<<s,0
  15. #define watch(x) cout << (#x) << " = " << x << endl
  16. void file() {
  17. #ifndef ONLINE_JUDGE
  18. freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
  19. #endif
  20. }
  21.  
  22. int main() {
  23. Fast;
  24. file();
  25. int x, mod;
  26. while (cin >> x >> mod) {
  27. map<int, bool> v;
  28. int s = 0;
  29. do {
  30. v[s] = true;
  31. s = (s + x) % mod;
  32. } while (!v[s]);
  33. cout << setw(10) << x;
  34. cout << setw(10) << mod;
  35. cout << " ";
  36. cout << (sz(v) == mod ? "Good Choice" : "Bad Choice")
  37. << endl << endl;
  38. }
  39. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty