December 24, 2022
A
B
C
做法二
#include <lastweapon/number>
using namespace lastweapon;
const int N = int(1e2) + 9;
Int f[2][N][N][N];
int n, m;
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif
RD(n, m, MOD);
int p = 0, q = 1; f[p][0][1][1] = 1;
#define u f[q][kk][ii][jj]
REP_1(a, n-1) {
swap(p, q); RST(f[p]);
REP(kk, min(a, m+1)) REP_1(ii, a) REP_1(jj, a) if (u) {
REP_1(i, a+1) REP_1(j, a+1) {
int k = kk + ((i > ii) && (j > jj) || (i <= ii) && (j <= jj));
f[p][k][i][j] += u;
}
}
}
Int z = 0; REP_1(i, n) REP_1(j, n) z += f[p][m][i][j];
cout << z << endl;
}
Posted by
xiaodao
Category: 日常