#K13361. Odd Sum Pair
Odd Sum Pair
Odd Sum Pair
You are given a list of integers. Your task is to determine whether it is possible to choose exactly two integers from the list such that their sum is odd.
A key observation is that the sum of two integers is odd if and only if one of them is even and the other is odd. In mathematical terms, for two integers \(a\) and \(b\), the sum is odd if and only if:
[ a+b\equiv 1 \pmod{2} ]
Given this, check each test case and print "YES" if such a pair exists, otherwise print "NO".
inputFormat
The first line of input contains an integer T
denoting the number of test cases.
For each test case:
- The first line contains an integer
n
indicating the number of integers in the list. - The second line contains
n
space-separated integers.
outputFormat
For each test case, output a single line containing "YES" if there exists a pair of integers whose sum is odd, and "NO" otherwise.
## sample3
4
1 2 3 4
3
2 4 6
5
1 3 5 7 9
YES
NO
NO
</p>