Recursion
Recursion-18
Recursion-19
Recursion-20
~/algor $ cat problems/rekursiya-sonni-qoshiluvchilarga-ajratish
Splitting a number into addends
Medium
1000 ms
128 MB
66%
You are given a positive integer $n$. Print all ways to write it as a sum of positive integers. The order of the addends does not matter, so in every way they are written in non-increasing order ($3 + 1 + 1$, but not $1 + 3 + 1$).
The ways are printed in decreasing lexicographic order: the first line is $n$ itself, the last one is $1 + 1 + \dots + 1$.
Input
One positive integer $n$.
Output
Each way on its own line: the addends joined by + without spaces (for example, 3+1).
Note
$1 \le n \le 20$
Examples
Input #1
4
Output #1
4 3+1 2+2 2+1+1 1+1+1+1
Input #2
3
Output #2
3 2+1 1+1+1