-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray with odd sum.cpp
More file actions
42 lines (42 loc) · 906 Bytes
/
Copy pathArray with odd sum.cpp
File metadata and controls
42 lines (42 loc) · 906 Bytes
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
#include<bits/stdc++.h>
#define ls long long signed
#define ll long long int
#define ld long double
#define fr for (int i=0; i<n; i++)
#define pf printf
#define dl double
ll i,j;
using namespace std;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll a;
cin>>a;
ll ara[a];
ll odd=0,even=0,sum=0;
for(i=0;i<a;i++){
cin>>ara[i];
if(ara[i]%2!=0 || ara[i]==1){
odd++;
}else{
even++;
}
sum=sum+ara[i];
}
if(sum%2!=0 || sum==1){
cout<<"YES"<<endl;
}
else{
if(odd!=0 && even!=0){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
}
return 0;
}