| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 21201 | 王兮 | 自然数的拆分 | C++ | Wrong Answer | 0 | 0 MS | 252 KB | 357 | 2021-06-26 19:24:52 |
#include<bits/stdc++.h> using namespace std; int n,a[10001]; void dfs(int l,int s,int x){ if(s>n)return; if(s==n){ cout<<n<<"="; for(int i=1;i<l;i++)cout<<a[i]<<"+"; cout<<a[l-1]<<endl; return; } for(int i=x;i>=1;i--){ a[l]=i; dfs(l+1,s+i,i); } } int main(){ cin>>n; cout<<n<<"="<<n<<endl; dfs(1,0,n-1); return 0; }