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

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; }


测评信息: