#K12986. Find Pair with Target Sum
Find Pair with Target Sum
Find Pair with Target Sum
Given a list of integers and a target sum \(T\), your task is to determine whether there exists a pair of distinct elements in the list whose sum equals \(T\). If such a pair exists, output True; otherwise, output False. Note that each element can be used at most once, and the two numbers must have different indices.
inputFormat
The input is given from standard input (stdin) in the following format:
The first line contains an integer (n) representing the number of elements in the list. The second line contains (n) space-separated integers, which are the elements of the list. The third line contains an integer (T), the target sum.
outputFormat
Output to standard output (stdout) a single line with either True if there exists a pair of distinct numbers summing to (T), or False if no such pair exists.## sample
4
10 15 3 7
17
True