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

#2361. 「NOIP2016」组合数问题

https://loj.ac/s/1579954
This commit is contained in:
Baoshuo Ren 2022-09-15 16:56:59 +08:00
parent 592ff4f485
commit c971054ca4
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
41 changed files with 163 additions and 0 deletions

43
LibreOJ/2361/2361.cpp Normal file
View File

@ -0,0 +1,43 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2005;
int t, k, n, m, c[N][N], f[N][N];
int main() {
cin >> t >> k;
c[1][1] = 1;
for (int i = 1; i <= 2000; i++) {
c[i][0] = c[i][i] = 1;
}
for (int i = 2; i <= 2000; i++) {
for (int j = 1; j < i; j++) {
c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % k;
}
}
for (int i = 1; i <= 2000; i++) {
for (int j = 1; j <= i; j++) {
f[i][j] = f[i][j - 1] + f[i - 1][j] - f[i - 1][j - 1];
if (!c[i][j]) f[i][j]++;
}
f[i][i + 1] = f[i][i];
}
while (t--) {
cin >> n >> m;
std::cerr << n << m << endl;
cout << f[n][std::min(n, m)] << endl;
}
return 0;
}

BIN
LibreOJ/2361/data/problem1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem11.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem12.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem13.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem14.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem15.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem16.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem17.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem18.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem19.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem20.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2361/data/problem9.in (Stored with Git LFS) Normal file

Binary file not shown.