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 |
Re:通俗版异或原理(附代码)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator