Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
74152 | 小徐老师 | 求和比较 | C++ | Accepted | 1 MS | 272 KB | 360 | 2024-05-23 15:05:48 |
#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; }