| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 20854 | 杨竣周 | 自然数的拆分 | C++ | Wrong Answer | 0 | 0 MS | 260 KB | 354 | 2021-06-20 16:29:37 |
#include<bits/stdc++.h> using namespace std; int a[666666],n; void dfs(int x,int sum,int f){ if(sum>n) return; if(sum==n){ cout<<endl<<n<<'='<<a[1]; for(int i=2;i<=x-1;i++) cout<<'+'<<a[i]; return; } for(int i=f;i>=1;i--){ a[x]=1; dfs(x+1,sum+i,i); } } int main(){ cin>>n; cout<<n<<'='<<n; dfs(1,0,n-1); return 0; }