#C11393. Unique Number Combinations
Unique Number Combinations
Unique Number Combinations
Aditi loves solving puzzles. In this problem, you are given a positive integer \(n\) and asked to find all unique combinations of numbers selected from \(\{1, 2, \dots, n\}\) that sum to \(n\). Each number may be used at most once in each combination. Every combination must be sorted in ascending order, and the overall list of combinations should be sorted based on the first element in each combination.
For example:
- Input: 4, Output: [[1, 3], [4]]
- Input: 5, Output: [[1, 4], [2, 3], [5]]
Your task is to implement the solution and output the result in a Python-like list format.
inputFormat
The input consists of a single integer \(n\) \((1 \le n \le 50)\) read from standard input.
outputFormat
Output the list of unique combinations in a Python-like list format. Each combination is represented as a list of integers. For example, when \(n = 4\), the output should be:
[[1, 3], [4]]## sample
4
[[1, 3], [4]]