0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 13:25:25 +00:00
OI-codes/Luogu/problem/P1358/P1358.cpp

29 lines
577 B
C++
Raw Normal View History

2020-10-18 09:49:09 +00:00
#include <bits/stdc++.h>
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;
}