#C10742. Even Array Transformation
Even Array Transformation
Even Array Transformation
You are given several test cases. Each test case consists of an integer n and an array of n integers. Your task is to determine whether it is possible to make all elements of the array even using a specific allowed operation.
The allowed operation is to pair two odd numbers. Since the sum of two odd numbers is even, if the count of odd numbers in the array is even, you can pair them up to eventually make all numbers even. Formally, let \(N_{odd}\) be the number of odd integers in the array. You need to check whether \(N_{odd} \mod 2 = 0\).
If \(N_{odd}\) is even, output YES
; otherwise, output NO
.
inputFormat
The input begins with an integer T (the number of test cases). For each test case, the first line contains an integer n (the size of the array). The next line contains n space-separated integers representing the array elements.
outputFormat
For each test case, output a single line containing either YES
if it is possible to make all array elements even, or NO
if it is not.## sample
4
3
1 2 3
4
2 4 6 8
2
7 5
5
0 0 0 0 1
YES
YES
YES
NO
</p>