建议降橙或加强数据
查看原帖
建议降橙或加强数据
1100695
hattt楼主2025/1/26 10:17
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n, k, cnt;
void dfs(ll x, ll y, ll z) {
	if (y == k + 1) {
		if (z == n) {
			cnt++;
		}
		return;
	}
	for (int i = x; i + z <= n; i++) {
		dfs(i, y + 1, i + z);
	}

}
int main() {
	cin >> n >> k;
	dfs(1, 1, 0);
	cout << cnt;
}

这不是纯板子吗,要不是深搜感觉可以评红

2025/1/26 10:17
加载中...