PS/BOJ

[백준] 암호만들기

RUBY_루비 2020. 10. 8. 23:59

출처:: https://www.acmicpc.net/problem/1759

분류:: 브루트 포스

 

1. 문제 이해 및 해결과정

 

2. 풀이방법

#암호 만들기
#https://www.acmicpc.net/problem/1759
import sys
from itertools import combinations
sys.stdin = open("input.txt","r")
n,m=map(int,input().split())
pos=[]
data=input().split()
data.sort()
selected=list(combinations(data,n))
# print(selected)
selected.sort()
for x in selected:
    con, vow = 0, 0
    for a in x:
        if a in 'aeiou':
            con+=1
        else:
            vow+=1
    if con>=1 and vow>=2: #최소 한개의 모음,두개의 자음
        print(''.join(x))

 

3. 오답원인

 

4. 알게된 점