Skip to content

Commit 9d838cb

Browse files
committed
[BOJ] 암호 만들기 / 골드 5 / 60분
https://www.acmicpc.net/problem/1759
1 parent 6ab89fb commit 9d838cb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def check_password(password):
2+
num_vowel = sum(1 for c in password if c in 'aeiou')
3+
num_consonant = len(password) - num_vowel
4+
return num_vowel >= 1 and num_consonant >= 2
5+
6+
def recursion(start, depth, password):
7+
if depth == L:
8+
if check_password(password):
9+
answers.append(password)
10+
return
11+
12+
for i in range(start, len(letters)):
13+
recursion(i + 1, depth + 1, password + letters[i])
14+
15+
L, C = map(int, input().split())
16+
letters = sorted(input().split())
17+
answers = []
18+
19+
recursion(0, 0, '')
20+
21+
for ans in answers:
22+
print(ans)

0 commit comments

Comments
 (0)