#K14481. Pair with a Given Sum

    ID: 24144 Type: Default 1000ms 256MiB

Pair with a Given Sum

Pair with a Given Sum

Given an array of integers and a target integer (T), determine if there exist two distinct elements (a_i) and (a_j) such that their sum satisfies (a_i + a_j = T).

This problem requires you to read input from standard input (stdin) and output the result to standard output (stdout). If there is such a pair, output True; otherwise, output False.

inputFormat

The first line contains an integer (n) representing the number of elements in the array. The second line contains (n) space-separated integers denoting the array elements. The third line contains an integer (T), the target sum.

outputFormat

Output a single line containing either True or False. Output True if there exists a pair of distinct elements whose sum is (T), otherwise output False.## sample

4
2 7 11 15
9
True