Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
74145 | Py自测 | 求和比较 | C++ | Accepted | 1 MS | 268 KB | 362 | 2024-05-23 11:03:41 |
#include <bits/stdc++.h> using namespace std; int n, m; int ans = 0; void f(int x, int s1, int s2) { if(x > n) { if(s1 - s2 == m) ans += 1; return ; } f(x + 1, s1 + x, s2); f(x + 1, s1, s2 + x); } int main() { cin >> n >> m; f(1, 0, 0); cout << ans << '\n'; return 0; }