#C9929. Two Sum Problem

    ID: 54076 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

You are given an array of integers and a target integer. Your task is to determine if there exist any two distinct elements in the array such that their sum is equal to the target. In other words, you need to check if there exist indices i and j (with i (\neq) j) such that (a_i + a_j = \text{target}).

The input will be provided via standard input. Your solution should read the input, process the array, and output either "True" or "False" (without quotes) to the standard output depending on whether such a pair exists.

inputFormat

The input is provided in three parts via standard input:

1. The first line contains an integer (n), representing the number of elements in the array.
2. The second line contains (n) space-separated integers, which are the elements of the array.
3. The third line contains an integer (target), the target sum.

outputFormat

Output a single line to standard output: "True" (without quotes) if there exists a pair of distinct elements whose sum equals the target, and "False" otherwise.## sample

4
2 7 11 15
9
True