From 8188ec299625b6cacbcad7dc305ecd1208e7a201 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 18 Oct 2020 17:49:09 +0800 Subject: [PATCH] =?UTF-8?q?P1358=20=E6=89=91=E5=85=8B=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R40056462 --- problem/P1358/P1358.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 problem/P1358/P1358.cpp diff --git a/problem/P1358/P1358.cpp b/problem/P1358/P1358.cpp new file mode 100644 index 00000000..a3e697f7 --- /dev/null +++ b/problem/P1358/P1358.cpp @@ -0,0 +1,28 @@ +#include + +using namespace std; + +long long n, m, t, f[10005][105], ans = 1; + +int main() { + cin >> n >> m; + for (int i = 0; i <= n; i++) { + f[i][0] = 1; + } + for (int i = 1; i <= min(n, m); i++) { + f[i][i] = 1; + } + for (int i = 1; i <= 10000; i++) { + for (int j = 0; j <= 100; j++) { + f[i][j] = (f[i - 1][j - 1] + f[i - 1][j]) % 10007; + } + } + for (int i = 1; i <= m; i++) { + cin >> t; + ans *= f[n][t]; + ans %= 10007; + n -= t; + } + cout << ans << endl; + return 0; +}