Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def check_password(password):
num_vowel = sum(1 for c in password if c in 'aeiou')
num_consonant = len(password) - num_vowel
return num_vowel >= 1 and num_consonant >= 2

def recursion(start, depth, password):
if depth == L:
if check_password(password):
answers.append(password)
return

for i in range(start, len(letters)):
recursion(i + 1, depth + 1, password + letters[i])

L, C = map(int, input().split())
letters = sorted(input().split())
answers = []

recursion(0, 0, '')

for ans in answers:
print(ans)
28 changes: 28 additions & 0 deletions YoonYn9915/greedy/2025-04-18-[백준]-#13305-주유소.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import sys

inp = sys.stdin.readline

n = int(inp())

roads = list(map(int, inp().split()))
oil_prices = list(map(int, inp().split()))

# 최소 비용
answer = 0
# 현재 도시
loc = 0

while True:
# 현재 도시보다 기름값이 적은 곳 찾기
for i in range(loc + 1, n):
if oil_prices[loc] > oil_prices[i] or i == n - 1:
# 이곳까지 가기 위해 현재 도시에서 주유하면서 비용 소모
# 현재 도시의 기름값 * i번 도시까지 가야 할 거리
answer += oil_prices[loc] * sum(roads[loc:i])
loc = i
break

if loc == n - 1:
break

print(answer)
22 changes: 22 additions & 0 deletions YoonYn9915/implementation/2025-04-19-[백준]-#6603-로또.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
from itertools import combinations

inp = sys.stdin.readline

while True:
arr = list(map(int, inp().split()))

# 0이면 종료
if arr[0] == 0:
break
# 0이 아니면
K = arr[0]
# combinations 라이브러리를 사용해 집합 S에서 조합 생성
answers = combinations(arr[1:K+1], 6)
Comment on lines +6 to +15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

백트래킹 풀이로만 풀었는데 윤상님 풀이로 조합 풀이도 확인할 수 있었습니다! 한주동안 문제 푸느라 수고 많으셨습니다!!


for answer in answers:
for num in answer:
print(num, end=' ')
print()

print()