#K48502. Unique Pairs Sum
Unique Pairs Sum
Unique Pairs Sum
You are given a list of integers and a target integer. Your task is to find all unique pairs of numbers from the list such that the sum of the two numbers is equal to the target. A pair is considered unique if it does not repeat another pair regardless of order; each pair should be output in non-decreasing order (i.e. the smaller number first) and the overall output should be sorted by the first number in each pair, then by the second.
If no such pairs exist, output nothing.
Note: The input is read from standard input (stdin) and the output should be printed to standard output (stdout).
Example:
Input: 5 1 2 3 4 5 5</p>Output: 1 4 2 3
Explanation: In the example, the pairs (1, 4) and (2, 3) sum to 5. Although (4, 1) is mathematically the same as (1, 4), it is not added again because each unique pair is included only once.
inputFormat
The first line contains an integer n, the number of elements in the list.
The second line contains n space-separated integers representing the list.
The third line contains an integer target, representing the target sum.
outputFormat
For each unique pair of numbers that add up to the target, print the two numbers separated by a space on a new line. The numbers within each pair must be in non-decreasing order and the pairs themselves should be sorted in increasing order based on the first number, and then the second number.
If there are no such pairs, do not print anything.
## sample5
1 2 3 4 5
5
1 4
2 3
</p>