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 | 31 |
Tags
- programmers
- MYSQL
- 백준
- 가상메모리 관리
- dfs
- 다이나믹 프로그래밍
- 다익스트라
- 수학
- 딕셔너리
- 그리디
- 파이썬
- BFS
- 코딩테스트
- level1
- 구현
- 프로그래머스
- BOJ
- 힙
- 가상메모리
- python
- level2
- N과M
- level3
- dict
- 재귀
- 운영체제
- DP
- level0
- 브루트포스
- 스택
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 |