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

#2173. 「FJOI2016」建筑师

https://loj.ac/s/1650817
This commit is contained in:
Baoshuo Ren 2022-12-09 20:57:44 +08:00
parent 088387d5e4
commit 73ebe1d928
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 112 additions and 0 deletions

52
LibreOJ/2173/2173.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5e4 + 5,
M = 205;
const int mod = 1e9 + 7;
int s[N][M], c[M][M];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
s[0][0] = s[1][1] = 1;
for (int i = 2; i < N; i++) {
s[i][1] = static_cast<long long>(s[i - 1][1]) * (i - 1) % mod;
}
for (int i = 2; i < N; i++) {
for (int j = 1; j < M && j <= i; j++) {
s[i][j] = (static_cast<long long>(s[i - 1][j - 1]) + static_cast<long long>(s[i - 1][j]) * (i - 1)) % mod;
}
}
for (int i = 0; i < M; i++) {
c[i][0] = c[i][i] = 1;
}
for (int i = 2; i < M; i++) {
for (int j = 1; j < i; j++) {
c[i][j] = (static_cast<long long>(c[i - 1][j]) + c[i - 1][j - 1]) % mod;
}
}
int t;
cin >> t;
while (t--) {
int n, a, b;
cin >> n >> a >> b;
cout << static_cast<long long>(s[n - 1][a + b - 2]) * c[a + b - 2][a - 1] % mod << endl;
}
return 0;
}

BIN
LibreOJ/2173/data/building1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2173/data/building9.out (Stored with Git LFS) Normal file

Binary file not shown.