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

Re:通俗版异或原理(附代码)

Posted by mingruoyuan at 2009-06-22 10:52:45 on Problem 2234
In Reply To:通俗版异或原理 Posted by:mingruoyuan at 2009-06-22 10:41:02
#include<stdio.h>
int main()
{
	int i,m,a[20];
	while(scanf("%d",&m)!=EOF)
	{
		for(i=0;i<m;i++)
			scanf("%d",&a[i]);
		for(i=1;i<m;i++)
			a[i]=a[i]^a[i-1];
		if(a[m-1]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}



















注意,代码里有个小错误,如果直接拷贝了提交,嘿嘿~~~
(如果是pascal语言,那么把^改成xor,这两个符号表示异或)

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