fork download
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. map<int,int> m;
  7. map<int, int> m1;
  8. vector<int> v;
  9.  
  10.  
  11. int main() {
  12. int n = 2010;
  13. for(int i = 0; i < n; i++) {
  14. int k= i;
  15. for(int j = 0; j< 2000;j++) {
  16. m[k]++;
  17. k = k*k % n;
  18. }
  19.  
  20. for(auto x : m) {
  21. if(x.second >= 1) {
  22. v.push_back(x.first);
  23. }
  24. }
  25.  
  26. m1[v.size()]++;
  27. v.clear();
  28. m.clear();
  29. }
  30. for(auto x : m1) {
  31. cout << x.first << ' ' << x.second << endl;
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0.02s 15232KB
stdin
Standard input is empty
stdout
1 16
2 54
3 92
4 48
10 240
11 840
12 720