HDU 2509

与HDU 1907一样。。。

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<cstdlib>
 4 #include<iostream>
 5 #include<queue>
 6 #include<stack>
 7 #include<cmath>
 8 #include<algorithm>
 9 #include<malloc.h>
10 using namespace std;
11 #define clc(a,b) memset(a,b,sizeof(a))
12 #define inf 0x3f3f3f3f
13 const int N=10010;
14 #define LL long long
15 const double eps = 1e-5;
16 const double pi = acos(-1);
17 // inline int r(){
18 //     int x=0,f=1;char ch=getchar();
19 //     while(ch>'9'||ch<'0'){if(ch=='-') f=-1;ch=getchar();}
20 //     while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
21 //     return x*f;
22 // }
23 
24 int main(){
25     int n;
26     while(~scanf("%d",&n)){
27        bool flag=false;
28        int ans=0;
29        for(int i=1;i<=n;i++){
30             int x;
31             scanf("%d",&x);
32             if(x>1) flag=true;
33             ans^=x;
34        }
35        if(!flag){
36         if(n&1){
37             printf("No
");
38         }
39         else 
40             printf("Yes
");
41        }
42        else{
43         if(ans==0){
44             printf("No
");
45         }
46         else{
47             printf("Yes
");
48         }
49        }
50    }
51     return 0;
52 }
View Code
原文地址:https://www.cnblogs.com/ITUPC/p/5417686.html