-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1759.cpp
52 lines (46 loc) · 1007 Bytes
/
1759.cpp
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
//
// Created by kdongha on 2019/11/29.
//
#include <bits/stdc++.h>
int L, C;
char arr[15];
char pwd[15];
int findVowel() {
int cnt = 0;
for (auto c:pwd) {
if (c == 'a' || c == 'o' || c == 'i' || c == 'e' || c == 'u') {
cnt++;
}
}
return cnt;
}
void comb(int idx, int count, int push) {
if (count == push) {
int vowel = findVowel();
if (vowel >= 1 && L - vowel >= 2) {
for (auto c = pwd; c < pwd + count; c++) {
std::cout << *c;
}
std::cout << "\n";
}
} else if (idx < C) {
pwd[push] = arr[idx];
comb(idx + 1, count, push + 1);
comb(idx + 1, count, push);
}
}
void solve() {
std::cin >> L >> C;
for (int i = 0; i < C; i++) {
std::cin >> arr[i];
}
std::sort(arr, arr + C);
comb(0, L, 0);
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(NULL);
solve();
return 0;
}