| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 153657 | 陈棋 | 求和比较 | C++ | Accepted | 1 MS | 268 KB | 401 | 2026-05-23 17:04:39 |
#include<iostream> using namespace std; int N,M; int target; int ans=0; void dfs(int index,int sum){ if(index==N+1){ if(sum==target) ans++; return; } dfs(index+1,sum); dfs(index+1,sum+index); } int main(){ cin>>N>>M; int total=N*(N+1)/2; if((total-M)<0||(total-M)%2!=0){ cout<<0<<endl; return 0; } target=(total-M)/2; dfs(1,0); cout<<ans<<endl; return 0; }