Codeforces 1027E Inverse Coloring
题目链接
![](https://img2018.cnblogs.com/blog/1491388/201810/1491388-20181018223103828-1659597608.png)
1 #include<bits/stdc++.h>
2 using namespace std;
3 #define N 1010
4 #define LL long long
5 #define Mod 998244353
6 int n,k;
7 LL dp[N][N],ans=0;
8 LL sum[N][N];
9 int main(){
10 cin>>n>>k;
11 dp[0][0]=1;
12 for(int i=1;i<=n;i++)
13 for(int j=1;j<=i;j++)
14 for(int p=1;p<=j;p++)
15 dp[i][j]=(dp[i][j]+dp[i-p][min(j,i-p)])%Mod;
16 for(int i=n;i>=1;i--)dp[n][i]=(dp[n][i]-dp[n][i-1]+Mod)%Mod;
17 for(int i=1;i<=n;i++)
18 for(int j=1;j*i<k;j++)
19 ans=(ans+dp[n][i]*dp[n][j]%Mod)%Mod;
20 ans=(ans*2)%Mod;
21 printf("%lld",ans);
22 return 0;
23 }