#C14344. Find Pair with Sum
Find Pair with Sum
Find Pair with Sum
Given a list of integers and a target sum \(T\), find the first pair of numbers \(a\) and \(b\) (in the order of appearance) such that \(a + b = T\). If no such pair exists, output None
.
The input is provided in standard input (stdin) where the first line contains an integer \(N\) denoting the number of elements in the list. The second line contains \(N\) space-separated integers, and the third line contains the target sum \(T\). The result should be printed to standard output (stdout). If a pair is found, print the two integers separated by a space; otherwise, print None
.
inputFormat
The first line contains an integer \(N\) representing the number of elements. The second line contains \(N\) space-separated integers. The third line contains an integer \(T\), the target sum.
outputFormat
If there is a pair \((a, b)\) such that \(a + b = T\), output the two numbers separated by a space. Otherwise, output None
.
5
1 2 3 4 5
7
3 4
</p>