From 6ea199fcc77f3711c0299bed176f337dd1bf8f12 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Sat, 12 Apr 2025 02:45:34 +0000 Subject: [PATCH 01/11] Update challenge progress dashboard --- _MonthlyChallenges/DASHBOARD.md | 4 ++-- _MonthlyChallenges/scoreboard.json | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/_MonthlyChallenges/DASHBOARD.md b/_MonthlyChallenges/DASHBOARD.md index aeea5f8..c567ebb 100644 --- a/_MonthlyChallenges/DASHBOARD.md +++ b/_MonthlyChallenges/DASHBOARD.md @@ -3,12 +3,12 @@ ### πŸ‘‰ κ·Έλž˜ν”„ - **Mingguriguri**: 5개 βœ… - **zaqquum**: 0개 ❌ -- **learntosurf**: 5개 βœ… +- **learntosurf**: 8개 βœ… ### πŸ‘‰ DP - **Mingguriguri**: 6개 βœ… - **zaqquum**: 2개 ❌ -- **learntosurf**: 6개 βœ… +- **learntosurf**: 9개 βœ… diff --git a/_MonthlyChallenges/scoreboard.json b/_MonthlyChallenges/scoreboard.json index d6b28bc..93f36f1 100644 --- a/_MonthlyChallenges/scoreboard.json +++ b/_MonthlyChallenges/scoreboard.json @@ -39,7 +39,10 @@ 4963, 4567, 5678, - 6789 + 6789, + 2776, + 1654, + 11663 ], "DP": [ 14430, @@ -47,7 +50,10 @@ 2293, 1234, 2345, - 3456 + 3456, + 5582, + 20542, + 2343 ], "achieved": { "κ·Έλž˜ν”„": true, From d63d01b49710d299eae6d4b40869f7b28bed0d32 Mon Sep 17 00:00:00 2001 From: Minjeong Kim <101111603+Mingguriguri@users.noreply.github.com> Date: Sat, 12 Apr 2025 16:14:12 +0900 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EC=9A=A9=20=EC=B9=B4=EC=9A=B4=ED=8A=B8=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _MonthlyChallenges/DASHBOARD.md | 4 ++-- _MonthlyChallenges/scoreboard.json | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/_MonthlyChallenges/DASHBOARD.md b/_MonthlyChallenges/DASHBOARD.md index c567ebb..aeea5f8 100644 --- a/_MonthlyChallenges/DASHBOARD.md +++ b/_MonthlyChallenges/DASHBOARD.md @@ -3,12 +3,12 @@ ### πŸ‘‰ κ·Έλž˜ν”„ - **Mingguriguri**: 5개 βœ… - **zaqquum**: 0개 ❌ -- **learntosurf**: 8개 βœ… +- **learntosurf**: 5개 βœ… ### πŸ‘‰ DP - **Mingguriguri**: 6개 βœ… - **zaqquum**: 2개 ❌ -- **learntosurf**: 9개 βœ… +- **learntosurf**: 6개 βœ… diff --git a/_MonthlyChallenges/scoreboard.json b/_MonthlyChallenges/scoreboard.json index 93f36f1..d6b28bc 100644 --- a/_MonthlyChallenges/scoreboard.json +++ b/_MonthlyChallenges/scoreboard.json @@ -39,10 +39,7 @@ 4963, 4567, 5678, - 6789, - 2776, - 1654, - 11663 + 6789 ], "DP": [ 14430, @@ -50,10 +47,7 @@ 2293, 1234, 2345, - 3456, - 5582, - 20542, - 2343 + 3456 ], "achieved": { "κ·Έλž˜ν”„": true, From a9d0e2008dfd1012d54617749dd24f23c1d46dc3 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 12 Apr 2025 23:41:05 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[BOJ]=20=EC=89=AC=EC=9A=B4=20=EA=B3=84?= =?UTF-8?q?=EB=8B=A8=20=EC=88=98=20/=20=EC=8B=A4=EB=B2=84=201=20/=20100?= =?UTF-8?q?=EB=B6=84=20=ED=9E=8C=ED=8A=B8=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/10844 --- ... \352\263\204\353\213\250 \354\210\230.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "YoonYn9915/dp/2025-04-10-[\353\260\261\354\244\200]-#10844-\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" diff --git "a/YoonYn9915/dp/2025-04-10-[\353\260\261\354\244\200]-#10844-\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" "b/YoonYn9915/dp/2025-04-10-[\353\260\261\354\244\200]-#10844-\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" new file mode 100644 index 0000000..1bf915a --- /dev/null +++ "b/YoonYn9915/dp/2025-04-10-[\353\260\261\354\244\200]-#10844-\354\211\254\354\232\264 \352\263\204\353\213\250 \354\210\230.py" @@ -0,0 +1,19 @@ + +N = int(input()) + +dp = [[0] * 10 for _ in range(N + 1)] + +for i in range(1, 10): + dp[1][i] = 1 + +for i in range(2, N + 1): + for j in range(10): + if j == 0: + dp[i][j] = dp[i - 1][1] + elif 1 <= j <= 8: + dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j + 1] + else: + dp[i][j] = dp[i - 1][8] + + +print(sum(dp[N]) % 1000000000) From bfb671612e3958d20f27a23e2dba281775811137 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 12 Apr 2025 23:42:48 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[BOJ]=20=EC=A2=85=EC=9D=B4=EC=9D=98=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=20/=20=EC=8B=A4=EB=B2=84=202=20/=2055?= =?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/1780 --- ...4\354\235\230 \352\260\234\354\210\230.py" | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 "YoonYn9915/recursion/2025-04-10-[\353\260\261\354\244\200]-#1780-\354\242\205\354\235\264\354\235\230 \352\260\234\354\210\230.py" diff --git "a/YoonYn9915/recursion/2025-04-10-[\353\260\261\354\244\200]-#1780-\354\242\205\354\235\264\354\235\230 \352\260\234\354\210\230.py" "b/YoonYn9915/recursion/2025-04-10-[\353\260\261\354\244\200]-#1780-\354\242\205\354\235\264\354\235\230 \352\260\234\354\210\230.py" new file mode 100644 index 0000000..333d475 --- /dev/null +++ "b/YoonYn9915/recursion/2025-04-10-[\353\260\261\354\244\200]-#1780-\354\242\205\354\235\264\354\235\230 \352\260\234\354\210\230.py" @@ -0,0 +1,45 @@ + +import sys + +def recursion(paper, row_start, col_start, step): + # 쒅이가 같은지 검사 + result = check_paper_same(paper, row_start, col_start, step) + + # κ°™μ§€ μ•Šλ‹€λ©΄ 9λΆ„ν• ν•œλ’€ 각각을 μž¬κ·€μ μœΌλ‘œ 검사 + if result == 2: + for i in range(3): + for j in range(3): + row = row_start + (i * step // 3) + col = col_start + (j * step // 3) + recursion(paper, row, col, step // 3) + else: + # μ’…μ΄μ˜ 칸이 λ‹€ 같은 경우 + answer[result] += 1 + + + +def check_paper_same(paper, row_start, col_start, step): + base = paper[row_start][col_start] + for i in range(row_start, row_start + step): + for j in range(col_start, col_start + step): + if paper[i][j] != base: + return 2 + return base + + +inp = sys.stdin.readline + +n = int(inp()) + +paper = [] + +# 각각 -1, 0, 1둜만 이루어진 μ’…μ΄μ˜ 개수 μ €μž₯ νŠœν”Œ +global answer +answer = {-1: 0, 0: 0, 1: 0} + +for i in range(n): + paper.append(list(map(int, inp().split()))) + +recursion(paper, 0, 0, n) + +print('\n'.join(str(value) for value in answer.values())) From eb468cabf4d6a40aec0d560ac247fca1604a5f84 Mon Sep 17 00:00:00 2001 From: YoonYn9915 <115504766+YoonYn9915@users.noreply.github.com> Date: Mon, 14 Apr 2025 21:40:54 +0900 Subject: [PATCH 05/11] Create W15-[DP]_1 --- _WeeklyChallenges/W15-[DP]_1 | 1 + 1 file changed, 1 insertion(+) create mode 100644 _WeeklyChallenges/W15-[DP]_1 diff --git a/_WeeklyChallenges/W15-[DP]_1 b/_WeeklyChallenges/W15-[DP]_1 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/_WeeklyChallenges/W15-[DP]_1 @@ -0,0 +1 @@ + From 94424b9611549640dfb9ba2dce30859141d4357c Mon Sep 17 00:00:00 2001 From: YoonYn9915 <115504766+YoonYn9915@users.noreply.github.com> Date: Mon, 14 Apr 2025 21:41:22 +0900 Subject: [PATCH 06/11] Delete _WeeklyChallenges/W15-[DP]_1 --- _WeeklyChallenges/W15-[DP]_1 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 _WeeklyChallenges/W15-[DP]_1 diff --git a/_WeeklyChallenges/W15-[DP]_1 b/_WeeklyChallenges/W15-[DP]_1 deleted file mode 100644 index 8b13789..0000000 --- a/_WeeklyChallenges/W15-[DP]_1 +++ /dev/null @@ -1 +0,0 @@ - From d93dfad616afb75efd1f6058a8a9d0e2b651bea7 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 12 Apr 2025 23:49:12 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[BOJ]=20=EA=B3=84=EB=8B=A8=20=EC=88=98=20?= =?UTF-8?q?/=20=EA=B3=A8=EB=93=9C=201=20/=2060=EB=B6=84=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/1562 --- ...-\352\263\204\353\213\250 \354\210\230.py" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "YoonYn9915/dp/2025-04-12-[\353\260\261\354\244\200]-#1562-\352\263\204\353\213\250 \354\210\230.py" diff --git "a/YoonYn9915/dp/2025-04-12-[\353\260\261\354\244\200]-#1562-\352\263\204\353\213\250 \354\210\230.py" "b/YoonYn9915/dp/2025-04-12-[\353\260\261\354\244\200]-#1562-\352\263\204\353\213\250 \354\210\230.py" new file mode 100644 index 0000000..70f90ef --- /dev/null +++ "b/YoonYn9915/dp/2025-04-12-[\353\260\261\354\244\200]-#1562-\352\263\204\353\213\250 \354\210\230.py" @@ -0,0 +1,26 @@ +import sys + +input = sys.stdin.readline + +N = int(input()) +dp = [[[0 for _ in range(1 << 10)] for _ in range(10)] for _ in range(N)] +mod = 1000000000 +res = 0 + +for k in range(1, 10): + dp[0][k][1 << k] = 1 + +for i in range(1, N): + for k in range(10): + for bit in range(1024): + if k - 1 >= 0: + dp[i][k][bit | (1 << k)] += dp[i - 1][k - 1][bit] + if k + 1 <= 9: + dp[i][k][bit | (1 << k)] += dp[i - 1][k + 1][bit] + dp[i][k][bit | (1 << k)] %= mod + +for k in range(10): + res += dp[N - 1][k][1023] + res %= mod + +print(res) From 7f1caf53a072b5653f4ea50c349515fca418733e Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Mon, 14 Apr 2025 12:42:47 +0000 Subject: [PATCH 08/11] Update challenge progress dashboard --- _MonthlyChallenges/DASHBOARD.md | 6 ---- _MonthlyChallenges/scoreboard.json | 56 +----------------------------- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/_MonthlyChallenges/DASHBOARD.md b/_MonthlyChallenges/DASHBOARD.md index aeea5f8..827e0f4 100644 --- a/_MonthlyChallenges/DASHBOARD.md +++ b/_MonthlyChallenges/DASHBOARD.md @@ -1,14 +1,8 @@ # πŸ”₯2025-04 μ±Œλ¦°μ§€ μ§„ν–‰ 상황 ### πŸ‘‰ κ·Έλž˜ν”„ -- **Mingguriguri**: 5개 βœ… -- **zaqquum**: 0개 ❌ -- **learntosurf**: 5개 βœ… ### πŸ‘‰ DP -- **Mingguriguri**: 6개 βœ… -- **zaqquum**: 2개 ❌ -- **learntosurf**: 6개 βœ… diff --git a/_MonthlyChallenges/scoreboard.json b/_MonthlyChallenges/scoreboard.json index d6b28bc..019d753 100644 --- a/_MonthlyChallenges/scoreboard.json +++ b/_MonthlyChallenges/scoreboard.json @@ -1,58 +1,4 @@ { "month": "2025-04", - "users": { - "Mingguriguri": { - "κ·Έλž˜ν”„": [ - 2206, - 13460, - 13163, - 12345, - 2345 - ], - "DP": [ - 2169, - 1520, - 11660, - 10844, - 1914, - 11727 - ], - "achieved": { - "κ·Έλž˜ν”„": true, - "DP": true - } - }, - "zaqquum": { - "κ·Έλž˜ν”„": [], - "DP": [ - 2169, - 1520 - ], - "achieved": { - "κ·Έλž˜ν”„": false, - "DP": false - } - }, - "learntosurf": { - "κ·Έλž˜ν”„": [ - 10026, - 4963, - 4567, - 5678, - 6789 - ], - "DP": [ - 14430, - 2342, - 2293, - 1234, - 2345, - 3456 - ], - "achieved": { - "κ·Έλž˜ν”„": true, - "DP": true - } - } - } + "users": {} } \ No newline at end of file From c65e44ca3bcfb5c540fbcef44d5276b71ddaab73 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Mon, 14 Apr 2025 21:37:57 +0900 Subject: [PATCH 09/11] =?UTF-8?q?weekly=20challenges=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=A3=BC=EC=B0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\354\212\244\353\205\270\355\212\270.py" | 0 _WeeklyChallenges/W14-[DP]/README.md | 19 ++++---- .../{W15-[DP] => W14-[DP]}/Study_BOJ_2342.pdf | Bin .../Study_BOJ_2342_DanceDanceRevolution.py | 0 ...nt_BOJ_2294_\353\217\231\354\240\204 2.py" | 40 ++++++++-------- _WeeklyChallenges/W15-[DP]/README.md | 19 ++++---- .../{W14-[DP] => W15-[DP]}/Study_BOJ_2293.pdf | Bin ...dy_BOJ_2293_\353\217\231\354\240\204 1.py" | 44 +++++++++--------- ...54\354\235\230\352\260\234\354\210\230.py" | 0 .../BFS]/README.md | 0 .../BFS]/Study_BOJ_10026.pdf | Bin ...01\353\241\235\354\203\211\354\225\275.py" | 0 12 files changed, 61 insertions(+), 61 deletions(-) rename "_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" => "_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" (100%) rename _WeeklyChallenges/{W15-[DP] => W14-[DP]}/Study_BOJ_2342.pdf (100%) rename _WeeklyChallenges/{W15-[DP] => W14-[DP]}/Study_BOJ_2342_DanceDanceRevolution.py (100%) rename "_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" => "_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" (94%) rename _WeeklyChallenges/{W14-[DP] => W15-[DP]}/Study_BOJ_2293.pdf (100%) rename "_WeeklyChallenges/W14-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" => "_WeeklyChallenges/W15-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" (93%) rename "_WeeklyChallenges/W15-[DFS/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" => "_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" (100%) rename _WeeklyChallenges/{W15-[DFS => W16-[DFS + BFS]}/BFS]/README.md (100%) rename _WeeklyChallenges/{W15-[DFS => W16-[DFS + BFS]}/BFS]/Study_BOJ_10026.pdf (100%) rename "_WeeklyChallenges/W15-[DFS/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" => "_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" (100%) diff --git "a/_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" "b/_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" similarity index 100% rename from "_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" rename to "_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2281_\353\215\260\354\212\244\353\205\270\355\212\270.py" diff --git a/_WeeklyChallenges/W14-[DP]/README.md b/_WeeklyChallenges/W14-[DP]/README.md index 55124e6..d793b59 100644 --- a/_WeeklyChallenges/W14-[DP]/README.md +++ b/_WeeklyChallenges/W14-[DP]/README.md @@ -1,17 +1,16 @@ -## πŸš€3μ›” 3μ£Όμ°¨ (3/22) μŠ€ν„°λ”” 발제 주제: DP -> 발제자: μ‘°μœ€μƒ (@YoonYn9915) +## πŸš€3μ›” 2μ£Όμ°¨ (3/10) μŠ€ν„°λ”” 발제 주제: Dynamic programming +> 발제자: 김홍주 -> 주제: DP +> 주제: Dynamic programming ### πŸ—‚οΈ μŠ€ν„°λ”” 자료 - PDF: [λ°”λ‘œκ°€κΈ° -](./Study_BOJ_2293.pdf) - -### πŸ“– 문제 -- [λ°±μ€€ #2293. 동전 1](https://www.acmicpc.net/problem/2293): DP / κ³¨λ“œ 4 -- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2293_동전 1.py](https://github.com/AlgorithmStudy-Allumbus/codingtest_algorithm_study/blob/fad656cae819a42bc7b82c541388bcf249df9604/_WeeklyChallenges/W14-%5BDP%5D/Assignment_BOJ_2294_%EB%8F%99%EC%A0%84%202.py) +](./Study_BOJ_2294.pdf) +### πŸ“– 문제 +- [λ°±μ€€ #2342. Dance Dance Revolution](https://www.acmicpc.net/problem/2342): Dynamic Programming / κ³¨λ“œ3 +- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2342_DanceDanceRevolution.py](./Study_BOJ_2342_DanceDanceRevolution) ### πŸ’» 과제 -- [λ°±μ€€ #2294. 동전 2](https://www.acmicpc.net/problem/2294): DP / κ³¨λ“œ 5 -- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2294_동전 2.py](https://github.com/AlgorithmStudy-Allumbus/codingtest_algorithm_study/blob/fad656cae819a42bc7b82c541388bcf249df9604/_WeeklyChallenges/W14-%5BDP%5D/Assignment_BOJ_2294_%EB%8F%99%EC%A0%84%202.py) +- [λ°±μ€€ #2281. λ°μŠ€λ…ΈνŠΈ](https://www.acmicpc.net/problem/2281): Dynamic Programming / κ³¨λ“œ4 +- μ •λ‹΅ μ½”λ“œ: [Assignment_BOJ_2281_λ°μŠ€λ…ΈνŠΈ.py](./Assignment_BOJ_2281_λ°μŠ€λ…ΈνŠΈ.py) diff --git a/_WeeklyChallenges/W15-[DP]/Study_BOJ_2342.pdf b/_WeeklyChallenges/W14-[DP]/Study_BOJ_2342.pdf similarity index 100% rename from _WeeklyChallenges/W15-[DP]/Study_BOJ_2342.pdf rename to _WeeklyChallenges/W14-[DP]/Study_BOJ_2342.pdf diff --git a/_WeeklyChallenges/W15-[DP]/Study_BOJ_2342_DanceDanceRevolution.py b/_WeeklyChallenges/W14-[DP]/Study_BOJ_2342_DanceDanceRevolution.py similarity index 100% rename from _WeeklyChallenges/W15-[DP]/Study_BOJ_2342_DanceDanceRevolution.py rename to _WeeklyChallenges/W14-[DP]/Study_BOJ_2342_DanceDanceRevolution.py diff --git "a/_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" "b/_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" similarity index 94% rename from "_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" rename to "_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" index 55f5534..6ae89bf 100644 --- "a/_WeeklyChallenges/W14-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" +++ "b/_WeeklyChallenges/W15-[DP]/Assignment_BOJ_2294_\353\217\231\354\240\204 2.py" @@ -1,21 +1,21 @@ -''' -BOJ #2294. 동전 2 (κ³¨λ“œ 5) -https://www.acmicpc.net/problem/2294 -μœ ν˜•: DP -''' - - -for _ in range(n): - arr.append(int(input())) - -dp = [100001 for i in range(k + 1)] -dp[0] = 0 - -for coin in arr: - for i in range(coin, k + 1): - dp[i] = min(dp[i], dp[i - coin] + 1) - -if dp[k] == 100001: - print(-1) -else: +''' +BOJ #2294. 동전 2 (κ³¨λ“œ 5) +https://www.acmicpc.net/problem/2294 +μœ ν˜•: DP +''' + + +for _ in range(n): + arr.append(int(input())) + +dp = [100001 for i in range(k + 1)] +dp[0] = 0 + +for coin in arr: + for i in range(coin, k + 1): + dp[i] = min(dp[i], dp[i - coin] + 1) + +if dp[k] == 100001: + print(-1) +else: print(dp[k]) \ No newline at end of file diff --git a/_WeeklyChallenges/W15-[DP]/README.md b/_WeeklyChallenges/W15-[DP]/README.md index d793b59..55124e6 100644 --- a/_WeeklyChallenges/W15-[DP]/README.md +++ b/_WeeklyChallenges/W15-[DP]/README.md @@ -1,16 +1,17 @@ -## πŸš€3μ›” 2μ£Όμ°¨ (3/10) μŠ€ν„°λ”” 발제 주제: Dynamic programming -> 발제자: 김홍주 +## πŸš€3μ›” 3μ£Όμ°¨ (3/22) μŠ€ν„°λ”” 발제 주제: DP +> 발제자: μ‘°μœ€μƒ (@YoonYn9915) -> 주제: Dynamic programming +> 주제: DP ### πŸ—‚οΈ μŠ€ν„°λ”” 자료 - PDF: [λ°”λ‘œκ°€κΈ° -](./Study_BOJ_2294.pdf) - +](./Study_BOJ_2293.pdf) ### πŸ“– 문제 -- [λ°±μ€€ #2342. Dance Dance Revolution](https://www.acmicpc.net/problem/2342): Dynamic Programming / κ³¨λ“œ3 -- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2342_DanceDanceRevolution.py](./Study_BOJ_2342_DanceDanceRevolution) +- [λ°±μ€€ #2293. 동전 1](https://www.acmicpc.net/problem/2293): DP / κ³¨λ“œ 4 +- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2293_동전 1.py](https://github.com/AlgorithmStudy-Allumbus/codingtest_algorithm_study/blob/fad656cae819a42bc7b82c541388bcf249df9604/_WeeklyChallenges/W14-%5BDP%5D/Assignment_BOJ_2294_%EB%8F%99%EC%A0%84%202.py) + + ### πŸ’» 과제 -- [λ°±μ€€ #2281. λ°μŠ€λ…ΈνŠΈ](https://www.acmicpc.net/problem/2281): Dynamic Programming / κ³¨λ“œ4 -- μ •λ‹΅ μ½”λ“œ: [Assignment_BOJ_2281_λ°μŠ€λ…ΈνŠΈ.py](./Assignment_BOJ_2281_λ°μŠ€λ…ΈνŠΈ.py) +- [λ°±μ€€ #2294. 동전 2](https://www.acmicpc.net/problem/2294): DP / κ³¨λ“œ 5 +- μ •λ‹΅ μ½”λ“œ: [Study_BOJ_2294_동전 2.py](https://github.com/AlgorithmStudy-Allumbus/codingtest_algorithm_study/blob/fad656cae819a42bc7b82c541388bcf249df9604/_WeeklyChallenges/W14-%5BDP%5D/Assignment_BOJ_2294_%EB%8F%99%EC%A0%84%202.py) diff --git a/_WeeklyChallenges/W14-[DP]/Study_BOJ_2293.pdf b/_WeeklyChallenges/W15-[DP]/Study_BOJ_2293.pdf similarity index 100% rename from _WeeklyChallenges/W14-[DP]/Study_BOJ_2293.pdf rename to _WeeklyChallenges/W15-[DP]/Study_BOJ_2293.pdf diff --git "a/_WeeklyChallenges/W14-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" "b/_WeeklyChallenges/W15-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" similarity index 93% rename from "_WeeklyChallenges/W14-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" rename to "_WeeklyChallenges/W15-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" index 94f4ec0..c19911a 100644 --- "a/_WeeklyChallenges/W14-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" +++ "b/_WeeklyChallenges/W15-[DP]/Study_BOJ_2293_\353\217\231\354\240\204 1.py" @@ -1,22 +1,22 @@ -''' -BOJ #2293. 동전 1 (κ³¨λ“œ4) -https://www.acmicpc.net/problem/2293 -μœ ν˜•: DP -''' - -n, k = map(int, input().split()) - -coin = [] -dp = [0] * (k + 1) - -for _ in range(n): - coin.append(int(input())) - -coin.sort() -dp[0] = 1 - -for c in coin: - for i in range(c, k+1): - dp[i] += dp[i-c] - -print(dp[k]) +''' +BOJ #2293. 동전 1 (κ³¨λ“œ4) +https://www.acmicpc.net/problem/2293 +μœ ν˜•: DP +''' + +n, k = map(int, input().split()) + +coin = [] +dp = [0] * (k + 1) + +for _ in range(n): + coin.append(int(input())) + +coin.sort() +dp[0] = 1 + +for c in coin: + for i in range(c, k+1): + dp[i] += dp[i-c] + +print(dp[k]) diff --git "a/_WeeklyChallenges/W15-[DFS/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" "b/_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" similarity index 100% rename from "_WeeklyChallenges/W15-[DFS/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" rename to "_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Assignment_BOJ_4963_\354\204\254\354\235\230\352\260\234\354\210\230.py" diff --git a/_WeeklyChallenges/W15-[DFS/BFS]/README.md b/_WeeklyChallenges/W16-[DFS + BFS]/BFS]/README.md similarity index 100% rename from _WeeklyChallenges/W15-[DFS/BFS]/README.md rename to _WeeklyChallenges/W16-[DFS + BFS]/BFS]/README.md diff --git a/_WeeklyChallenges/W15-[DFS/BFS]/Study_BOJ_10026.pdf b/_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Study_BOJ_10026.pdf similarity index 100% rename from _WeeklyChallenges/W15-[DFS/BFS]/Study_BOJ_10026.pdf rename to _WeeklyChallenges/W16-[DFS + BFS]/BFS]/Study_BOJ_10026.pdf diff --git "a/_WeeklyChallenges/W15-[DFS/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" "b/_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" similarity index 100% rename from "_WeeklyChallenges/W15-[DFS/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" rename to "_WeeklyChallenges/W16-[DFS + BFS]/BFS]/Study_BOJ_10026_\354\240\201\353\241\235\354\203\211\354\225\275.py" From 6c9f2e21872c0e0e39c6f0d41383974c739ff23a Mon Sep 17 00:00:00 2001 From: learntosurf Date: Mon, 14 Apr 2025 22:52:29 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[BOJ]=20#1759.=EC=95=94=ED=98=B8=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EA=B3=A8=EB=93=9C5=20/=2030(?= =?UTF-8?q?O)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 8 ++++++ ...70\353\247\214\353\223\244\352\270\260.py" | 26 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 "learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..eecbcdc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "github.copilot.enable": { + "*": false, + "plaintext": false, + "markdown": false, + "scminput": false + } +} \ No newline at end of file diff --git "a/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" "b/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" new file mode 100644 index 0000000..d615625 --- /dev/null +++ "b/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" @@ -0,0 +1,26 @@ +import sys +input = sys.stdin.readline +from itertools import combinations + +L, C = map(int, input().split()) +chars = input().split() +chars.sort() # μ˜€λ¦„μ°¨μˆœ μ •λ ¬ + +candidates = list(combinations(chars, L)) # L개 κ³ λ₯΄λŠ” λͺ¨λ“  쑰합을 생성 + +# 쑰건에 λ§žλŠ” μ‘°ν•© 필터링 +# 쑰건: λͺ¨μŒ >= 1개, 자음 >= 2개 +vowels = set('aeiou') + +for comb in candidates: + vowel_count = 0 + consonant_count = 0 + + for ch in comb: + if ch in vowels: + vowel_count += 1 + else: + consonant_count += 1 + + if vowel_count >= 1 and consonant_count >= 2: + print(''.join(comb)) \ No newline at end of file From d7267085f479a82e6071ccd1317381b1bdce7acc Mon Sep 17 00:00:00 2001 From: learntosurf Date: Mon, 14 Apr 2025 23:25:10 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[BOJ]=20#1759.=EC=95=94=ED=98=B8=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EA=B3=A8=EB=93=9C5=20/=2030(?= =?UTF-8?q?O)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- ...70\353\247\214\353\223\244\352\270\260.py" | 48 +++++++++++++------ ...70\353\247\214\353\223\244\352\270\260.py" | 26 ++++++++++ 3 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 "learntosurf/BruteForce/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" diff --git a/.gitignore b/.gitignore index 201666e..58a821a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .cph/ .DS_Store -.DS_Store +.vscode/ diff --git "a/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" "b/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" index d615625..e4f75ca 100644 --- "a/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" +++ "b/learntosurf/Backtracking/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" @@ -6,21 +6,39 @@ chars = input().split() chars.sort() # μ˜€λ¦„μ°¨μˆœ μ •λ ¬ -candidates = list(combinations(chars, L)) # L개 κ³ λ₯΄λŠ” λͺ¨λ“  쑰합을 생성 - -# 쑰건에 λ§žλŠ” μ‘°ν•© 필터링 -# 쑰건: λͺ¨μŒ >= 1개, 자음 >= 2개 vowels = set('aeiou') +result = [] -for comb in candidates: - vowel_count = 0 - consonant_count = 0 - - for ch in comb: - if ch in vowels: - vowel_count += 1 - else: - consonant_count += 1 +# λ°±νŠΈλž˜ν‚Ή: ν•΄λ₯Ό μ°ΎλŠ” 도쀑 ν•΄κ°€ μ•„λ‹ˆμ–΄μ„œ λ§‰νžˆλ©΄, λ˜λŒμ•„κ°€μ„œ λ‹€μ‹œ ν•΄λ₯Ό μ°Ύμ•„κ°€λŠ” 기법 +# ν˜„μž¬κΉŒμ§€ λ§Œλ“  μ•”ν˜Έμ˜ 길이가 L이면 μ’…λ£Œ 쑰건 +# λͺ¨μŒ/자음 개수λ₯Ό μ²΄ν¬ν•΄μ„œ λ§Œμ‘±ν•  경우 좜λ ₯ +# κ·Έλ ‡μ§€ μ•ŠμœΌλ©΄ λ‹€μŒ μ•ŒνŒŒλ²³μ„ 선택해 μž¬κ·€ 호좜 +def backtrack(path, start): + # 1. μ’…λ£Œ 쑰건: 길이가 L이면 μ‘°ν•© μ™„μ„± + if len(path) == L: + vowel_count = 0 + consonant_count = 0 + + # λͺ¨μŒ/자음 개수 μ„ΈκΈ° + for ch in path: + if ch in vowels: + vowel_count += 1 + else: + consonant_count += 1 + + # 쑰건에 맞으면 좜λ ₯ + if vowel_count >= 1 and consonant_count >= 2: + print(''.join(path)) + return - if vowel_count >= 1 and consonant_count >= 2: - print(''.join(comb)) \ No newline at end of file + # 2. κ°€λŠ₯ν•œ λͺ¨λ“  λ¬Έμžμ— λŒ€ν•΄ 선택 + for i in range(start, C): # C == len(chars) + # 선택 + path.append(chars[i]) + # μž¬κ·€ 호좜(λ‹€μŒ 문자 선택) - μ‘°ν•©μ΄λ―€λ‘œ i+1λΆ€ν„° + backtrack(path, i+1) + # 선택 μ·¨μ†Œ + path.pop() + +# 탐색 μ‹œμž‘ +backtrack([], 0) \ No newline at end of file diff --git "a/learntosurf/BruteForce/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" "b/learntosurf/BruteForce/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" new file mode 100644 index 0000000..d615625 --- /dev/null +++ "b/learntosurf/BruteForce/2025-04-14-[BOJ]-#1759-\354\225\224\355\230\270\353\247\214\353\223\244\352\270\260.py" @@ -0,0 +1,26 @@ +import sys +input = sys.stdin.readline +from itertools import combinations + +L, C = map(int, input().split()) +chars = input().split() +chars.sort() # μ˜€λ¦„μ°¨μˆœ μ •λ ¬ + +candidates = list(combinations(chars, L)) # L개 κ³ λ₯΄λŠ” λͺ¨λ“  쑰합을 생성 + +# 쑰건에 λ§žλŠ” μ‘°ν•© 필터링 +# 쑰건: λͺ¨μŒ >= 1개, 자음 >= 2개 +vowels = set('aeiou') + +for comb in candidates: + vowel_count = 0 + consonant_count = 0 + + for ch in comb: + if ch in vowels: + vowel_count += 1 + else: + consonant_count += 1 + + if vowel_count >= 1 and consonant_count >= 2: + print(''.join(comb)) \ No newline at end of file