-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbj_1342.cpp
More file actions
43 lines (37 loc) · 808 Bytes
/
bj_1342.cpp
File metadata and controls
43 lines (37 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <climits>
#include <vector>
#include <stack>
#include <set>
using namespace std;
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
string S;
cin >> S;
vector<char> V;
for(int i = 0; i<S.size(); i++) {
V.push_back(S[i]);
}
sort(V.begin(), V.end());
int cnt = 0;
do {
char pos = V[0];
bool check = false;
for(int i = 1; i<S.size(); i++) {
if(V[i] == pos){
check = true;
break;
}
pos = V[i];
}
if(check == false) {
cnt++;
}
} while(next_permutation(V.begin(), V.end()));
cout << cnt << "\n";
}