From 53b7ee692e652160292941416631ca8bba12db37 Mon Sep 17 00:00:00 2001 From: Do Hyeon Seok Date: Sun, 11 May 2025 02:26:57 +0900 Subject: [PATCH 1/2] 2025-05-11 --- dohyeondol1/DP/12-dohyeondol1.cpp | 25 +++++++++++++++++++++++++ dohyeondol1/README.md | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 dohyeondol1/DP/12-dohyeondol1.cpp diff --git a/dohyeondol1/DP/12-dohyeondol1.cpp b/dohyeondol1/DP/12-dohyeondol1.cpp new file mode 100644 index 0000000..d267b12 --- /dev/null +++ b/dohyeondol1/DP/12-dohyeondol1.cpp @@ -0,0 +1,25 @@ +#include +#include +using namespace std; + +int main() { + int N, K; + cin >> N >> K; + + vector> dp(N+1, vector (K+1, 0)); + for(int i = 0; i <= N; i++) { + dp[i][0] = 0; + dp[i][1] = 1; + } + + for(int i = 0; i <= K; i++) + dp[0][i] = 1; + + for(int i = 1; i <= N; i++) + for(int j = 2; j <= K; j++) + dp[i][j] = (dp[i-1][j] + dp[i][j-1])%1000000000; + + cout << dp[N][K] << '\n'; + + return 0; +} \ No newline at end of file diff --git a/dohyeondol1/README.md b/dohyeondol1/README.md index ecae6d3..952e382 100644 --- a/dohyeondol1/README.md +++ b/dohyeondol1/README.md @@ -10,3 +10,7 @@ | 6차시 | 2025.04.05 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/22| | 7차시 | 2025.04.08 | 트리 | [트리 순회](https://www.acmicpc.net/problem/1991)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/26| | 8차시 | 2025.04.11 | 덱 | [회전하는 큐](https://www.acmicpc.net/problem/1021)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/32| + | 9차시 | 2025.04.30 | 그리디 알고리즘 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/33| + | 10차시 | 2025.05.04 | 완전 탐색 | [소수 찾기](https://school.programmers.co.kr/learn/courses/30/lessons/42839)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/37| + | 11차시 | 2025.05.06 | DP | [동전 1](https://www.acmicpc.net/problem/2293)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/39| +| 12차시 | 2025.05.11 | DP | [합분해](https://www.acmicpc.net/problem/2225)|https://github.com/AlgoLeadMe/AlgoLeadMe-13/pull/45| From 35bbd8f86576393c11987d7eed71f1c1e6baed1d Mon Sep 17 00:00:00 2001 From: Do Hyeon Seok Date: Sun, 11 May 2025 03:46:01 +0900 Subject: [PATCH 2/2] Update 12-dohyeondol1.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 정답 여부에는 영향이 없지만 잘못된 초기값 설정 수정 --- dohyeondol1/DP/12-dohyeondol1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dohyeondol1/DP/12-dohyeondol1.cpp b/dohyeondol1/DP/12-dohyeondol1.cpp index d267b12..c68d23e 100644 --- a/dohyeondol1/DP/12-dohyeondol1.cpp +++ b/dohyeondol1/DP/12-dohyeondol1.cpp @@ -8,7 +8,7 @@ int main() { vector> dp(N+1, vector (K+1, 0)); for(int i = 0; i <= N; i++) { - dp[i][0] = 0; + dp[i][0] = 1; dp[i][1] = 1; }