Advertisement
Josif_tepe

Untitled

Nov 5th, 2024
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <map>
  6. using namespace std;
  7.  
  8. int main() {
  9.     string s;
  10.     cin >> s;
  11.     map<string, bool> visited;
  12.     sort(s.begin(), s.end());
  13.     int res = 0;
  14.     do {
  15.         if(s[0] != '0' and !visited[s]) {
  16.             visited[s] = true;
  17.             res++;
  18.         }
  19.        
  20.     } while(next_permutation(s.begin(), s.end()));
  21.    
  22.     cout << res << endl;
  23.     return 0;
  24.    
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement