比赛 |
CSP2023-S模拟赛 |
评测结果 |
AAATTTATTTTTTTTTTTAT |
题目名称 |
Maximized Combos |
最终得分 |
25 |
用户昵称 |
文殊院 |
运行时间 |
15.173 s |
代码语言 |
C++ |
内存使用 |
8.59 MiB |
提交时间 |
2023-10-17 19:25:02 |
显示代码纯文本
#include<iostream>
using namespace std;
#define MAXN 120
long long n, m, a[MAXN], ans = 0;
void dfs(int x, int step, int tmp, int maxn) {
if(step > m) return;
if(x > n) {
if(step == m && maxn <= m) a[maxn] ++;
return;
}
dfs(x + 1, step, 0, maxn);
tmp ++; maxn = max(maxn, tmp);
dfs(x + 1, step + 1, tmp, maxn);
return;
}
int main() {
freopen("combos.in", "r", stdin);
freopen("combos.out", "w", stdout);
cin >> n >> m;
if(m == 1) { cout << n << "\n"; return 0; }
if(n == 1) { for(int i = 1; i <= m; i ++) cout << 0 << "\n"; return 0; }
if(n == m) { for(int i = 1; i < m; i ++) cout << 0 << "\n"; cout << 1 << "\n"; return 0; }
dfs(1, 0, 0, 0);
for(int i = 1; i <= m; i ++) cout << a[i] << "\n";
return 0;
}