-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1759.cpp
58 lines (54 loc) · 1.15 KB
/
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
53
54
55
56
57
58
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<char> v;
vector<char> password;
int length, num;
int vowel, conso;
void printpw(int start, int cnt)
{
// 출력
if (cnt == length)
{
vowel = 0;
conso = 0;
for (int i = 0; i < password.size(); i++)
{
if (password[i] == 'a' || password[i] == 'e' || password[i] == 'i' || password[i] == 'o' || password[i] == 'u')
vowel++;
else
conso++;
}
if (vowel >= 1 && conso >= 2)
{
for (int i = 0; i < password.size(); i++)
{
cout << password[i];
}
cout << '\n';
}
return;
}
// 루프돌면서 printpw에 넣어주기
for (int i = start; i < v.size(); i++)
{
password.push_back(v[i]);
printpw(i + 1, cnt + 1);
password.pop_back();
}
return;
}
int main()
{
cin >> length >> num;
for (int i = 0; i < num; i++)
{
char c;
cin >> c;
v.push_back(c);
}
sort(v.begin(), v.end());
printpw(0, 0);
return 0;
}