#C14349. Find a Pair with a Given Sum

    ID: 43988 Type: Default 1000ms 256MiB

Find a Pair with a Given Sum

Find a Pair with a Given Sum

You are given a list of integers and a target integer. Your task is to determine whether there exist two distinct elements in the list such that their sum is equal to the target. Formally, given a list (A = [a_1, a_2, \dots, a_n]) and an integer (T), check if there exist indices (i \neq j) such that (a_i + a_j = T).

If such a pair exists, output True; otherwise, output False.

inputFormat

The input is given via 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 represent the list elements.
The third line contains an integer (T), the target sum.

outputFormat

Output a single line to standard output (stdout) containing either True if a pair of distinct elements exists that add up to the target (T), or False if no such pair exists.## sample

5
1 3 5 7 9
12
True

</p>