| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我化成二进制之后判断各位的奇偶性过不了,为什么呀?using namespace std;
int main()
{
int n;
int i;
int j,t,to;
int a[40][22]={0};
while(cin>>n)
{
for(i=0;i<n;i++)
{
cin>>a[0][i];
j=t=1;
while(a[0][i])
{
a[j][i]=a[0][i]%2;
a[0][i]/=2;
j++;
}
if(j>t)
t=j;
}
to=0;
for(j=0;j<t;j++)
{
for(i=0;i<n;i++)
{
to+=a[j][i];
a[j][i]=0;
}
if(to%2!=0)
break;
}
if(j==t)
cout<<"No"<<endl;
else
cout<<"Yes"<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator