#t329. 自然数的拆分问题
自然数的拆分问题
Splitting a Natural Number
Problem Background
Special for beginners, ^_^
Problem Description
Any natural number greater than can always be split into a sum of several natural numbers smaller than . Given a natural number , you are to find all the ways to split into a sum of numbers. In each split, the numbers are sorted in ascending order. Output these splits with the lexicographically smallest sequence printed first.
Input Format
The natural number to be split.
Output Format
Several addition expressions.
Sample Input
7
Sample Output
1+1+1+1+1+1+1
1+1+1+1+1+2
1+1+1+1+3
1+1+1+2+2
1+1+1+4
1+1+2+3
1+1+5
1+2+2+2
1+2+4
1+3+3
1+6
2+2+3
2+5
3+4
Constraints
1s, 1024KiB for each test case.
Hint
Think about how to reduce a problem of size into a smaller subproblem.