You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
851 B
45 lines
851 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int nums[60];
|
|
|
|
void process(int n) {
|
|
int a = 0, b = -1;
|
|
for (int i = 0; i < n; i++) {
|
|
if (nums[i] == 1)
|
|
a++;
|
|
else
|
|
b += nums[i] + 1;
|
|
}
|
|
if (a == 0 && b > 0) {
|
|
if (b % 2)
|
|
puts("YES");
|
|
else
|
|
puts("NO");
|
|
}
|
|
if (a > 0 && b > 2) {
|
|
if (a % 2 || b % 2)
|
|
puts("YES");
|
|
else
|
|
puts("NO");
|
|
}
|
|
if (a > 0 && b <= 2) {
|
|
if (a % 3)
|
|
puts("YES");
|
|
else
|
|
puts("NO");
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
int t, n;
|
|
cin >> t;
|
|
while (t--) {
|
|
memset(nums, 0, sizeof(nums));
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++)
|
|
cin >> nums[i];
|
|
process(n);
|
|
}
|
|
return 0;
|
|
} |