标签:pac ORC tps lock cout turn fine cond fir
一开始发现的性质是确定了第一行后,后面的行只需要考虑和前面的行相同或者不同,整个过程只需要考虑行,构出的图一定符合性质(即同样满足列的性质),但是接下来死活定义不出状态,事实证明自己还是想的太少了
思路:https://www.cnblogs.com/tobyw/p/9513876.html
代码:
#include<bits/stdc++.h>
#define ll long long
#define mk make_pair
#define ft first
#define se second
#define pii pair<int,int>
#define db double
#define ls o<<1
#define rs o<<1|1
#define lowbit(x) (x&-x)
using namespace std;
const ll P = 998244353;
ll n, k, f[505][505], res[505];
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++){
f[0][i] = 1;
for(int j = 1; j <= n; j++){
for(int p = 1; p <= min(i, j); p++){
f[j][i] += f[j - p][i];
f[j][i] %= P;
}
}
}
ll ans = 0;
for(int i = 1; i <= n; i++){
res[i] = (f[n][i] - f[n][i - 1] + P) % P;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(i * j < k){
ans += res[i] * res[j] % P;
ans %= P;
}else
break;
}
}
ans *= 2;
ans %= P;
cout << ans << endl;
return 0;
}
codeforces 1027E. Inverse Coloring(计数)
标签:pac ORC tps lock cout turn fine cond fir
原文地址:https://www.cnblogs.com/VIrtu0s0/p/11918804.html