Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我化成二进制之后判断各位的奇偶性过不了,为什么呀?

Posted by kensin2 at 2005-06-10 00:53:30 on Problem 2234
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator