From e32329eb76d44c87d8abd676965cac1c10e803d5 Mon Sep 17 00:00:00 2001 From: flowjiyun Date: Mon, 13 Feb 2023 08:58:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20solved=2011051=20=EC=9D=B4=ED=95=AD?= =?UTF-8?q?=EA=B3=84=EC=88=982=20-=20dp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiyunpar/math/11051.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 jiyunpar/math/11051.cpp diff --git a/jiyunpar/math/11051.cpp b/jiyunpar/math/11051.cpp new file mode 100644 index 0000000..f2f3f2a --- /dev/null +++ b/jiyunpar/math/11051.cpp @@ -0,0 +1,29 @@ +#include + +using namespace std; + +// nCk = n-1Ck-1 + n-1Ck + +int dp[1005][1005]; + +int main(void) +{ + ios::sync_with_stdio(0); + cin.tie(0); + int n, k; + cin >> n >> k; + for (int i = 1; i <= n; ++i) + { + dp[i][0] = 1; + dp[i][i] = 1; + for (int j = 1; j <= i; ++j) + { + if (i == 1) + break; + dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % 10007; + } + } + cout << dp[n][k]; + return (0); + +} \ No newline at end of file