Codeforces 1363A - Odd Selection Solution

  Solution in C++: 

///******Bismillahir-Rahmanir-Rahim******///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh 

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

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.