Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
46400 zhouhuanyu 玙静 求和比较 C++ 通过 1 MS 248 KB 310 2024-05-03 14:52:33

Tests(1/1):


#include <bits/stdc++.h> using namespace std; int N, M, cnt; void dfs(int n, int m){ if(n == 0){ cnt++; } if(m > n){ return ; } for(int i = m; i <= N; i++){ dfs(n - i, i + 1); } } int main(){ cin >> N >> M; M = (N * (N + 1) / 2 - M) / 2; dfs(M, 1); cout << cnt; return 0; }


测评信息: