#C14423. Pair Sum Finder
Pair Sum Finder
Pair Sum Finder
Given a list of integers and a target value, your task is to find two numbers in the list such that their sum equals the target value. If such a pair exists, output the two numbers separated by a space in the order they appear in the list; otherwise, output -1.
If there are multiple valid pairs, output any one of them.
Note: The solution must read input from stdin
and write the result to stdout
.
inputFormat
The input consists of three lines:
- The first line contains a single integer n, representing the number of elements in the list.
- The second line contains n space-separated integers.
- The third line contains a single integer, the target value.
outputFormat
If a pair is found, output the two numbers separated by a space. Otherwise, output -1.
## sample4
2 7 11 15
9
2 7