mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 14:18:47 +00:00
4710. [Jsoi2011] 分特产
https://hydro.ac/d/bzoj/record/63e0d2d9dd8145683f793e11
This commit is contained in:
parent
6067adf5c3
commit
fc3ab0c801
53
BZOJ/4710/4710.cpp
Normal file
53
BZOJ/4710/4710.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#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
BZOJ/4710/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/4710/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/4710/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user