#C6942. Taco Pairs Finder
Taco Pairs Finder
Taco Pairs Finder
You are given a list of integers and a target integer. Your task is to find all unique pairs \((a, b)\) in the list such that \(a + b = \text{target}\) and \(a \le b\). The resulting pairs must be printed in lexicographical order.
If no such pairs exist, output "No pairs found".
Each pair should be printed on a new line in the format (a, b)
.
inputFormat
The input is given via standard input (stdin) and consists of three parts:
- 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 of numbers.
- The third line contains an integer representing the target sum.
outputFormat
Output the unique pairs ((a, b)) satisfying (a + b = \text{target}) and (a \le b) in lexicographical order, each on a separate line in the format (a, b)
. If there are no such pairs, output "No pairs found".## sample
5
1 2 3 4 5
5
(1, 4)
(2, 3)
</p>