标签:个数 main msu bsp def tps 长度 sele www
#include <iostream> using namespace std; int t,n,x,ji,ou; int a[1007]; int main(){ scanf("%d",&t); while(t--){ scanf("%d%d",&n,&x); ji=0,ou=0; for(int i=1;i<=n;i++){\\统计数组中奇数和偶数的个数 scanf("%d",&a[i]); if(a[i]%2==0) ou++; else ji++; } if(x%2==0){ int n1=x-1,n2=1,flag=0;\\将x拆分 while(n1>0){\\遍历拆分的x if(ji>=n1&&ou>=n2){ flag=1; } n1-=2,n2+=2; } if(flag) cout<<"Yes"<<endl; else cout<<"No"<<endl; }else{ int n1=x,n2=0,flag=0; while(n1>0){ if(ji>=n1&&ou>=n2){ flag=1; } n1-=2,n2+=2; } if(flag) cout<<"Yes"<<endl; else cout<<"No"<<endl; } } }
标签:个数 main msu bsp def tps 长度 sele www
原文地址:https://www.cnblogs.com/kksk/p/13028191.html