-
Notifications
You must be signed in to change notification settings - Fork 1
/
1472B.cpp
53 lines (51 loc) · 976 Bytes
/
1472B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
using namespace std;
bool isdub(int arr[], int len)
{
for (int i = 1; i < len; i++)
{
if (arr[0] != arr[i])
{
return false;
}
}
return true;
}
int main(int argc, char const *argv[])
{
int t, len, sum = 0;
cin >> t;
string ans[t];
for (int i = 0; i < t; i++)
{
sum = 0;
cin >> len;
int candies[len];
for (int j = 0; j < len; j++)
{
cin >> candies[j];
}
if (len % 2 != 0 && isdub(candies, len))
{
ans[i] = "NO";
}
else
{
for (int j = 0; j < len; j++)
{
sum += candies[j];
}
if (sum % 2 == 0)
{
ans[i] = "YES";
}
else
ans[i] = "NO";
}
}
for (int i = 0; i < t; i++)
{
cout << ans[i] << "\n";
}
return 0;
}