diff --git "a/YoonYn9915/backtracking/2025-04-14-[\353\260\261\354\244\200]-#1759-\354\225\224\355\230\270 \353\247\214\353\223\244\352\270\260.py" "b/YoonYn9915/backtracking/2025-04-14-[\353\260\261\354\244\200]-#1759-\354\225\224\355\230\270 \353\247\214\353\223\244\352\270\260.py" new file mode 100644 index 00000000..b79ed829 --- /dev/null +++ "b/YoonYn9915/backtracking/2025-04-14-[\353\260\261\354\244\200]-#1759-\354\225\224\355\230\270 \353\247\214\353\223\244\352\270\260.py" @@ -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) diff --git "a/YoonYn9915/greedy/2025-04-18-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" "b/YoonYn9915/greedy/2025-04-18-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" new file mode 100644 index 00000000..e8f5cdbf --- /dev/null +++ "b/YoonYn9915/greedy/2025-04-18-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" @@ -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) \ No newline at end of file diff --git "a/YoonYn9915/implementation/2025-04-19-[\353\260\261\354\244\200]-#6603-\353\241\234\353\230\220.py" "b/YoonYn9915/implementation/2025-04-19-[\353\260\261\354\244\200]-#6603-\353\241\234\353\230\220.py" new file mode 100644 index 00000000..a71d37d3 --- /dev/null +++ "b/YoonYn9915/implementation/2025-04-19-[\353\260\261\354\244\200]-#6603-\353\241\234\353\230\220.py" @@ -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) + + for answer in answers: + for num in answer: + print(num, end=' ') + print() + + print() \ No newline at end of file