0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:48:48 +00:00

#145. 【2020.11.30 NOIP模拟赛 T2】矩阵游戏

https://sjzezoj.com/submission/70880
This commit is contained in:
Baoshuo Ren 2023-02-17 16:18:41 +08:00
parent ba2d1e93ad
commit 8dbd7b2da0
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
42 changed files with 191 additions and 0 deletions

68
S2OJ/145/145.cpp Normal file
View File

@ -0,0 +1,68 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int inv[N], fac[N], inv_fac[N];
int C(int n, int m) {
return static_cast<long long>(fac[n]) * inv_fac[m] % mod * inv_fac[n - m] % mod;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
fac[0] = 1;
for (int i = 1; i < N; i++) {
fac[i] = static_cast<long long>(fac[i - 1]) * i % mod;
}
inv[0] = inv[1] = 1;
for (int i = 2; i < N; i++) {
inv[i] = static_cast<long long>(mod - (mod / i)) * inv[mod % i] % mod;
}
inv_fac[0] = inv_fac[1] = 1;
for (int i = 2; i < N; i++) {
inv_fac[i] = static_cast<long long>(inv_fac[i - 1]) * inv[i] % mod;
}
// ======
int t;
cin >> t;
while (t--) {
int n, m, k, res1 = 0, res2 = 0, res3 = 0, res4 = 0;
cin >> n >> m >> k;
for (int i = k & 1; i <= std::min(n, k); i += 2) {
res1 = (res1 + C(n, i)) % mod;
}
for (int i = k & 1; i <= std::min(m, k); i += 2) {
res2 = (res2 + C(m, i)) % mod;
}
if (n % 2 == 0 && m % 2 == 0) {
for (int i = std::max(n - k, 0); i <= std::min(n, k); i += 2) {
res3 = (res3 + C(n, i)) % mod;
}
for (int i = std::max(m - k, 0); i <= std::min(m, k); i += 2) {
res4 = (res4 + C(m, i)) % mod;
}
}
cout << ((static_cast<long long>(res1) * res2 % mod - static_cast<long long>(res3) * res4 % mod * inv[2] % mod) + mod) % mod << endl;
}
return 0;
}

BIN
S2OJ/145/data/matrix1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix11.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix12.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix13.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix14.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix15.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix16.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix17.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix18.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix19.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix20.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/145/data/matrix9.in (Stored with Git LFS) Normal file

Binary file not shown.

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

Binary file not shown.