Advertisement
maxim_shlyahtin

0321

Jul 13th, 2022
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. vector<int> f(int n, int b) {
  9.     vector<int> x;
  10.     while (n != 0) {
  11.         x.push_back(n % b);
  12.         n /= b;
  13.     }
  14.     return x;
  15. }
  16.  
  17.    
  18.  
  19.  
  20. int main()
  21. {  
  22.     int n;
  23.     cin >> n;
  24.     for (int i = 2; i < 37; i++) {
  25.         vector<int> a;
  26.         a = f(n, i);
  27.         set<int> s(a.begin(), a.end());
  28.         if (a.size() == s.size()) { cout << i << ' '; }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement