#C2399. Unique Sum Combinations

    ID: 45710 Type: Default 1000ms 256MiB

Unique Sum Combinations

Unique Sum Combinations

Given a positive integer ( n ), your task is to find all unique combinations of positive integers that sum up to ( n ). Each combination must be a non-decreasing sequence. For example, when ( n = 5 ), the valid combinations are:

[ [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 4], [2, 3], [5]] ]

Make sure to generate the combinations in the order as demonstrated in the example.

inputFormat

The input consists of a single line containing an integer ( n ) (where ( 1 \le n \le 30 )).

outputFormat

Output a single line representing the list of lists (in Python-style list format) of all unique combinations of positive integers that sum up to ( n ). Each inner list must be a non-decreasing sequence of integers. See the sample outputs for clarification.## sample

1
[[1]]