0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#1896. 【JSOI2011】分特产

https://sjzezoj.com/submission/68109
This commit is contained in:
Baoshuo Ren 2023-02-06 20:57:51 +08:00
parent fc3ab0c801
commit 0bb91dfd42
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
22 changed files with 117 additions and 0 deletions

54
S2OJ/1896/1896.cpp Normal file
View File

@ -0,0 +1,54 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2005;
const int mod = 1e9 + 7;
int n, m, a[N], c[N][N], f[N], ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
c[0][0] = 1;
for (int i = 1; i < N; ++i) {
c[i][0] = 1;
for (int j = 1; j <= i; ++j) {
c[i][j] = (static_cast<long long>(c[i - 1][j - 1]) + c[i - 1][j]) % mod;
}
}
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
f[i] = 1;
for (int j = 1; j <= m; j++) {
f[i] = static_cast<long long>(f[i]) * c[n - i + a[j] - 1][n - i - 1] % mod;
}
f[i] = static_cast<long long>(f[i]) * c[n][i] % mod;
}
for (int i = 0; i < n; i++) {
if (i % 2 == 0) {
ans = (static_cast<long long>(ans) + f[i]) % mod;
} else {
ans = (static_cast<long long>(ans) - f[i] + mod) % mod;
}
}
cout << ans << endl;
return 0;
}

BIN
S2OJ/1896/data/data1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/data9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1896/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.