| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 20860 | 陈思雨 | 自然数的拆分 | C++ | Compile Error | 0 | 0 MS | 0 KB | 372 | 2021-06-20 16:31:55 |
#include<bits/stdc++.h> using namespace std; int n,a[100001]; void dfs(int x,int sum,int f){ if(sun>n) return; if(sum==n){ cout<<n<<"="<<a[1]; for(int i=2;i<=x-1;i++) cout<<"+"<<a[i]; cout<<endl; return; } for(int i=f;i>=1;i--){ a[x]=i; dfs(x+1,sum+i,i); } } int main(){ cin>>n; cout<<n<<"="<<n<<endl; dfs(1,0,n-1); return 0; }