#C13026. Pair Sum Checker
Pair Sum Checker
Pair Sum Checker
You are given multiple test cases. In each test case, you are provided with a list of integers and a target integer \(T\). Your task is to determine whether there exists a pair of distinct numbers in the list such that their sum equals \(T\). The solution should process each test case and output True
if such a pair exists, or False
otherwise.
Example:
Input: 1 3 1 2 3 5</p>Output: True
In the example above, since 2 + 3 = 5, the answer is True
.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. The description of each test case is as follows:
- An integer \(N\) representing the number of elements in the list.
- A line containing \(N\) space-separated integers.
- An integer \(T\) which is the target sum.
Note: For cases where \(N = 0\), the line with numbers will be empty.
outputFormat
For each test case, output a single line containing either True
if there exists a pair of numbers in the list whose sum is equal to the target, or False
otherwise.
5
3
1 2 3
5
3
1 2 3
6
0
10
2
4 4
8
2
10 20
30
True
False
False
True
True
</p>