# bzoj3678 简单题

bitset

 1 #include<algorithm>
2 #include<iostream>
3 #include<cstdlib>
4 #include<cstring>
5 #include<cstdio>
6 #include<string>
7 #include<bitset>
8 #include<cmath>
9 #include<ctime>
10 #include<queue>
11 #include<stack>
12 #include<map>
13 #include<set>
14 #define rre(i,r,l) for(int i=(r);i>=(l);i--)
15 #define re(i,l,r) for(int i=(l);i<=(r);i++)
16 #define Clear(a,b) memset(a,b,sizeof(a))
17 #define inout(x) printf("%d",(x))
18 #define douin(x) scanf("%lf",&x)
19 #define strin(x) scanf("%s",(x))
20 #define LLin(x) scanf("%lld",&x)
21 #define op operator
22 #define CSC main
23 typedef unsigned long long ULL;
24 typedef const int cint;
25 typedef long long LL;
26 using namespace std;
27 void inin(int &ret)
28 {
29     ret=0;int f=0;char ch=getchar();
30     while(ch<'0'||ch>'9'){if(ch=='-')f=1;ch=getchar();}
31     while(ch>='0'&&ch<='9')ret*=10,ret+=ch-'0',ch=getchar();
32     ret=f?-ret:ret;
33 }
34 int n,sum,ans;
35 bitset<2000020> a;
36 int main()
37 {
38     cin>>n;a[0]=1;
39     re(i,1,n)
40     {
41         int x;cin>>x;
42         sum+=x;
43         a^=a<<x;
44     }
45     re(i,1,sum)if(a[i])ans^=i;
46     cout<<ans;
47      return 0;
48 }

posted @ 2016-03-14 19:25  HugeGun  阅读(219)  评论(0编辑  收藏  举报