#C11290. Unique Pair Sums
Unique Pair Sums
Unique Pair Sums
You are given a list of integers. Your task is to compute the unique sums of all possible pairs, where each pair is formed by selecting two distinct integers from the list.
The unique sums must be output in ascending order. If the list has fewer than two elements, output an empty list (no output).
Note: Even if the list contains duplicate numbers, each pair should be considered only once and each sum should appear uniquely in the output.
inputFormat
The input begins with an integer n (n ≥ 0) indicating the number of elements in the list. The next line contains n space-separated integers.
Example Input: 3 1 2 3
outputFormat
Output the unique pair sums in sorted (ascending) order on a single line, separated by single spaces. If no pair can be formed, output nothing.## sample
3
1 2 3
3 4 5