#C12283. Pair Sum Existence
Pair Sum Existence
Pair Sum Existence
Given an array of integers and a target integer, determine whether there exists a pair of distinct integers whose sum equals the target. In other words, find two different indices i and j such that \(a_i + a_j = T\), where \(T\) is the target.
You are required to read the input from stdin and write the output to stdout as either True
or False
.
inputFormat
The input consists of three lines:
- The first line contains an integer \(n\), representing the number of elements in the array.
- The second line contains \(n\) space-separated integers.
- The third line contains an integer \(T\), the target sum.
outputFormat
Output a single line with either True
if there exists a pair of distinct integers in the array whose sum is equal to \(T\); otherwise, output False
.
4
2 7 11 15
9
True
</p>