1 solutions
-
-1
C++ :
#include<bits/stdc++.h> using namespace std; int n,t=0,s=0; int a[105]; void st(int x) { if(x==1) { for(int i=1;i<=t;i++) cout<<a[i]<<"-"; cout<<1<<endl; s++; } else { a[++t]=x; for(int i=1;i<=x/2;i++) st(i); t--; } } int main() { cin>>n; st(n); cout<<s; return 0; }
- 1
Information
- ID
- 656
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 0
- Uploaded By