#K86682. Find Pair With Sum

    ID: 36919 Type: Default 1000ms 256MiB

Find Pair With Sum

Find Pair With Sum

Your task is to determine whether there exist two distinct indices in an array such that the sum of the elements at these indices equals a given target T. Formally, given an array \(a_1, a_2, \dots, a_n\) and an integer \(T\), you should find whether there exist two distinct indices \(i\) and \(j\) (with \(i \neq j\)) such that \(a_i + a_j = T\).

The input is provided via standard input (stdin) and the result should be printed to standard output (stdout). Output 1 if such a pair exists, otherwise output 0.

inputFormat

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

outputFormat

Output a single integer: 1 if there exists a pair of two distinct indices such that their sum equals (T), and 0 otherwise.## sample

4
2 7 11 15
9
1

</p>