Codeforces 1296A - Array with Odd Sum Solution

 Solution in C++: 

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh 

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. long long t,n,i,odd,a;
  7. cin>>t;
  8. while(t--)
  9. {
  10. cin>>n;
  11. odd=0;
  12. for(i=0; i<n; i++)
  13. {
  14. cin>>a;
  15. if(a%2!=0)
  16. odd++;
  17. }
  18. if(n%2==0 && odd==n)
  19. cout<<"NO"<<endl;
  20. else if(odd >0)
  21. cout<<"YES"<<endl;
  22. else
  23. cout<<"NO"<<endl;
  24.  
  25. }
  26. }

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.