我到底错哪了qaq(样例能过,0分,WA
查看原帖
我到底错哪了qaq(样例能过,0分,WA
350621
lzl2007楼主2020/6/7 13:35
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,j,nn,a[500000],sum,k=0,p,max,ans[20],num=1;
	cin>>n;
	for(i=1;i<=n;i++){
		max=0;
		cin>>nn;
		for(j=1;j<=nn;j++){
			cin>>p;
			sum=1;
			while(p>0){
				a[sum]+=p%2;
				p=p/2;
				sum++;
			}
			if(sum>max)max=sum-1;
		}
		for(j=1;j<=sum;j++){
		    if(a[j]%2!=0)k=1;
	    }
	    if(k!=1)ans[num]=0;
	    else ans[num]=1;
	    num++;
	    memset(a,0,sizeof(a));
	}
	for(i=1;i<=n;i++){
		if(ans[i]==0)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}

然后。。。全部WA (语言C++

2020/6/7 13:35
加载中...