From 902820d3bff0ba3e04bde3037ce402749ed36480 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Tue, 22 Sep 2026 17:03:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?4811=20:=20=EC=95=8C=EC=95=BD=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week7/BOJ4811/BOJ4811_V1.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/week7/BOJ4811/BOJ4811_V1.cpp diff --git a/src/week7/BOJ4811/BOJ4811_V1.cpp b/src/week7/BOJ4811/BOJ4811_V1.cpp new file mode 100644 index 0000000..9ce55a0 --- /dev/null +++ b/src/week7/BOJ4811/BOJ4811_V1.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +long long DP[31][31]; +int type[2]; +int N; +long long solve(int W, int H) { + if (W == 0 && H == 0) return 1; + if (DP[W][H]) return DP[W][H]; + + long long int &ret = DP[W][H]; + if (W > 0) ret += solve(W-1, H+1); + if (H > 0) ret += solve(W, H-1); + + return ret; +} +int main() { + + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + cout.tie(nullptr); + + + while(true) { + int n; + cin >> n; + if (n == 0) break; + cout << solve(n, 0) << '\n'; + } + + + return 0; +} \ No newline at end of file From 5d3181664185bf723ea4472b29dfee04c775eb9c Mon Sep 17 00:00:00 2001 From: sh0723 Date: Tue, 22 Sep 2026 17:06:35 +0900 Subject: [PATCH 2/2] =?UTF-8?q?4811=20:=20=EC=95=8C=EC=95=BD=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week7/BOJ4811/BOJ4811_V1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/week7/BOJ4811/BOJ4811_V1.cpp b/src/week7/BOJ4811/BOJ4811_V1.cpp index 9ce55a0..0f76ac3 100644 --- a/src/week7/BOJ4811/BOJ4811_V1.cpp +++ b/src/week7/BOJ4811/BOJ4811_V1.cpp @@ -29,4 +29,4 @@ int main() { return 0; -} \ No newline at end of file +}