#C14257. Has Pair with Sum
Has Pair with Sum
Has Pair with Sum
Given a list of integers and a target sum \(T\), check whether there exist two distinct elements in the list such that their sum is exactly \(T\). The program should read input from stdin and write the result to stdout.
Input Format:
- The first line contains an integer \(n\), denoting the number of elements in the list.
- The second line contains \(n\) space-separated integers.
- The third line contains an integer \(T\), the target sum.
Output Format:
- Output "True" if there exists a pair of distinct elements whose sum equals \(T\). Otherwise, output "False".
The solution must use the standard input and standard output streams.
inputFormat
The input is read from stdin and consists of three lines:
- An integer \(n\) --- the number of elements in the list.
- \(n\) space-separated integers representing the list of numbers.
- An integer \(T\) representing the target sum.
outputFormat
The output should be printed to stdout. It is a single line containing either "True" if there exists a pair of distinct elements whose sum equals \(T\) or "False" otherwise.
## sample5
5 3 9 1 7
8
True
</p>