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 925 (Div. 3) 1931D. Divisible Pairs Solution

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

Powered by Blogger.