Skip to content

Commit 2e4d9e0

Browse files
committed
Added 1296A - Array with Odd Sum.cpp
1 parent 2e9b443 commit 2e4d9e0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

1296A - Array with Odd Sum.cpp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
int n;
16+
cin>>n;
17+
int a[n];
18+
int sum = 0, odd = 0, even = 0;
19+
for(int i=0; i<n; i++)
20+
{
21+
cin>>a[i];
22+
if(a[i]%2!=0 || a[i]==1)
23+
odd++;
24+
else
25+
even++;
26+
sum += a[i];
27+
}
28+
if(sum%2!=0 || sum==1)
29+
cout<<"YES"<<endl;
30+
else
31+
{
32+
if(odd!=0 && even!=0)
33+
cout<<"YES"<<endl;
34+
else
35+
cout<<"NO"<<endl;
36+
}
37+
}
38+
return 0;
39+
}

0 commit comments

Comments
 (0)