From 9d838cbbc8520b1d3845fba00884fdddbc6df68e Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Fri, 18 Apr 2025 07:54:50 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[BOJ]=20=EC=95=94=ED=98=B8=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0=20/=20=EA=B3=A8=EB=93=9C=205=20/=2060?= =?UTF-8?q?=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/1759 --- ...0 \353\247\214\353\223\244\352\270\260.py" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "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" 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) From a58fe7db87ea332d8d23c60110723fb3a4c7b3af Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Fri, 18 Apr 2025 07:55:02 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[BOJ]=20=EC=A3=BC=EC=9C=A0=EC=86=8C=20/=20?= =?UTF-8?q?=EC=8B=A4=EB=B2=84=203=20/=2030=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/13305 --- ...5-\354\243\274\354\234\240\354\206\214.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "YoonYn9915/greedy/2025-04-18-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" 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 From a1f5ef084ccaa05f4090b547c345c8c6463c66d7 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 19 Apr 2025 16:59:34 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[BOJ]=20=EB=A1=9C=EB=98=90=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=84=202=20/=2030=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/6603 --- ...44\200]-#6603-\353\241\234\353\230\220.py" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "YoonYn9915/implementation/2025-04-19-[\353\260\261\354\244\200]-#6603-\353\241\234\353\230\220.py" 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