#K80102. Find Pair with Given Sum

    ID: 35456 Type: Default 1000ms 256MiB

Find Pair with Given Sum

Find Pair with Given Sum

Given an array (A) of (n) integers and an integer (S), determine whether there exist two distinct elements (a) and (b) in (A) such that (a+b=S). The output should be either "True" if such a pair exists, or "False" otherwise.

For example, if (A = [2, 7, 11, 15]) and (S=9), then the answer is "True" because (2+7=9).

inputFormat

The input is given via standard input (stdin) in the following format:
(n): an integer representing the number of elements in the array.
Next line: (n) space-separated integers representing the array (A).
Last line: an integer (S) denoting the target sum.

outputFormat

Output a single line to standard output (stdout) containing either "True" if there exists a pair of distinct elements that sums to (S), or "False" otherwise.## sample

4
2 7 11 15
9
True

</p>