1296A Solution Codeforces Round #617

Revision en1, by nick2k19, 2020-02-06 14:22:17

Solution explanation

github link:

``#include <bits/stdc++.h>

using namespace std;

int main() { int t; cin>>t; int n; int sum; int odd; int even;

for(int i=0;i<t;i++){ cin>>n; sum=0; odd=0; even=0; int arr[n]; for(int j=0;j<n;j++){ cin>>arr[j]; if(arr[j]%2!=0 || arr[j]==1){ odd++; }else{ even++; } sum+=arr[j]; }

if(sum%2!=0 || sum==1){
       cout<<"YES"<<endl;
   }
   else{
       if(odd!=0 && even!=0){
           cout<<"YES"<<endl;
       }
       else{
           cout<<"NO"<<endl;
       }
   }

}
}``

Tags #math, #solution, #round 617, #1296a, #codeforces, #div 3, #div 2

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English nick2k19 2020-02-06 14:27:57 33
en1 English nick2k19 2020-02-06 14:22:17 939 Initial revision (published)