#C14946. Two Sum Pair Finder
Two Sum Pair Finder
Two Sum Pair Finder
Given an array of integers and a target integer, your task is to find a pair of numbers in the array that add up to the target. Formally, given an array \(A = [a_1, a_2, \dots, a_n]\) and an integer \(T\), find two distinct numbers \(a_i\) and \(a_j\) (with \(i \neq j\)) such that:
[ a_i + a_j = T ]
If such a pair exists, output the two numbers as they appear (the order being the one discovered by your algorithm). If no such pair exists, output "None". It is guaranteed that if a valid pair exists, then printing any one correct pair is acceptable.
inputFormat
The input is given from standard input (stdin) and consists of two lines:
- The first line contains two integers \(n\) and \(T\), where \(n\) is the number of elements in the array and \(T\) is the target sum.
- The second line contains \(n\) space-separated integers representing the array \(A\).
outputFormat
Output to standard output (stdout) the pair of integers which add up to the target, separated by a space. If there is no such pair, output "None".
## sample4 9
2 7 11 15
2 7