-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbj_1759.cpp
More file actions
61 lines (51 loc) · 1.15 KB
/
bj_1759.cpp
File metadata and controls
61 lines (51 loc) · 1.15 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <algorithm>
#include <string>
// 꽤나 어려웠음 ㅠ 다시 풀기
using namespace std;
int L, C;
string moeum[5] = {"a", "e", "i", "o", "u"};
int cnt = 0;
int cnt2 = 0;
void check (int ind[16], string alphabet[16]) {
cnt = 0;
cnt2 = 0;
for(int i = 0; i<C; i++) {
if(ind[i] == 0) {
for(int j = 0; j<5; j++) {
if(moeum[j].compare(alphabet[i]) == 0) {
cnt++;
}
}
}
}
cnt2 = L - cnt;
if(cnt > 0 && cnt2 >=2) {
for(int i = 0; i<C; i++) {
if(ind[i] == 0)
cout << alphabet[i];
}
cout << "\n";
}
}
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> L >> C;
string alphabet[16] = {};
for(int i = 0; i<C; i++) {
cin >> alphabet[i];
}
sort(alphabet, alphabet+C);
int ind[16] = {};
for(int i = 0; i<L; i++) {
ind[i] = 0;
}
for(int i = L; i<C; i++) {
ind[i] = 1;
}
do {
check(ind, alphabet);
} while(next_permutation(ind, ind+C));
}