728x90
숫자가 작아서 조합으로 풀었다.
import sys
from itertools import combinations
L,C = list(map(int,sys.stdin.readline().rstrip().split(" ")))
k = list(sys.stdin.readline().rstrip().split(" "))
mo = ['a','e','i','o','u']
temp = list(combinations(k,L))
answer = [ ]
for i in range(0,len(temp)):
a = temp[i]
momo = 0
jaja = 0
for j in range(0,len(a)):
if a[j] in mo:
momo += 1
else:
jaja += 1
if momo>=1 and jaja>=2:
a = list(sorted(a))
answer.append("".join(a))
answer = list(sorted(answer))
for i in answer:
print(i)
728x90
'🟢 알고리즘 문제 풀이 > Baekjoon' 카테고리의 다른 글
| [파이썬] 백준 14889 스타트와 링크 (0) | 2023.06.20 |
|---|---|
| [파이썬] 백준 2529 부등호 (0) | 2023.06.20 |
| [파이썬] 백준 14501 퇴사 (0) | 2023.06.19 |
| [파이썬] 백준 10971 외판원 순회 2 (0) | 2023.06.14 |
| [파이썬] 백준 9095 1, 2, 3 더하기 (0) | 2023.06.12 |