比赛 |
CSP2023-S模拟赛 |
评测结果 |
AAAAAAAAAAEEEEEEEEEE |
题目名称 |
Maximized Combos |
最终得分 |
50 |
用户昵称 |
liuyiche |
运行时间 |
2.184 s |
代码语言 |
C++ |
内存使用 |
12.58 MiB |
提交时间 |
2023-10-17 20:17:56 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int n, m, s;
const int mod = 998244353;
int f[102][102][102][2];
inline int dfs(int step, int cnt, int one, int best)
{
if(step == n+1)
{
if(m == one && best == 1)
return 1;
return 0;
}
if(f[step][cnt][one][best] != -1)
return f[step][cnt][one][best];
int all = 0;
if(m-one < n-step+1)
all += dfs(step+1,0,one,best);
all %= mod;
if(cnt+1 <= s && one+1 <= m)
{
if(cnt+1 == s)
all += dfs(step+1,cnt+1,one+1,1);
else
all += dfs(step+1,cnt+1,one+1,best);
}
all %= mod;
return f[step][cnt][one][best] = all;
}
int main()
{
freopen("combos.in", "r", stdin);
freopen("combos.out", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= m; ++i)
{
memset(f,-1,sizeof(f));
s = i;
cout << dfs(1,0,0,0) << '\n';
}
return 0;
}