
Level 5
Programming Implementation of the Natural Number Partition Problem
Specific Requirements
Any natural number n greater than 1 can be expressed as the sum of several natural numbers less than n. Given a natural number n, please output all possible partitions of it. Each partition sequence should be sorted in ascending order. When outputting these sequences, those with lexicographically smaller sequences should be output first.
Input: A natural number n (1 ≤ n ≤ 10).
Output: Several lines, each line representing a partition of n in an additive format.
Sample Input
7
Sample Output
1+1+1+1+1+1+1
1+1+1+1+1+2180
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
The programming problem only looks at the final result presentation,
not the specific programming implementation process!
If you encounter difficulties, be sure to consult your teacher in a timely manner!
