Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- level0
- dict
- 브루트포스
- 프로그래머스
- 딕셔너리
- 파이썬
- 가상메모리
- 가상메모리 관리
- programmers
- 운영체제
- 그리디
- MYSQL
- 구현
- BFS
- level2
- python
- 수학
- 다익스트라
- 재귀
- dfs
- 힙
- 백준
- 스택
- BOJ
- level1
- DP
- level3
- 코딩테스트
- N과M
- 다이나믹 프로그래밍
Archives
- Today
- Total
동캄의 코딩도장
백준 1759 [암호만들기] 파이썬 본문
https://www.acmicpc.net/problem/1759
import sys
import itertools
input = sys.stdin.readline
L, C = map(int, input().split())
lst = list(map(str, input().split()))
lst.sort()
combi = itertools.combinations(lst, L)
for p in combi:
count = 0
count = (p.count('a')+p.count('e')+p.count('i')+p.count('o')+p.count('u'))
if count >= 1 and count <= L-2:
print(''.join(p))
permutation을 하면서 모음의 개수와 자음의 개수를 센다.
'코테 > BOJ' 카테고리의 다른 글
백준 10808 [알파벳 개수] 파이썬 (0) | 2022.02.09 |
---|---|
백준 14501 [퇴사] 파이썬 (0) | 2022.02.09 |
백준 10819 [차이를 최대로] 파이썬 (0) | 2022.02.09 |
백준 11724 [연결 요소의 개수] 파이썬 (0) | 2022.02.08 |
백준 1260 [DFS와 BFS] 파이썬 (0) | 2022.02.08 |