BZOJ3687【bitset】

来源:互联网 发布:qq飞车天使之翼数据 编辑:程序博客网 时间:2024/04/29 02:06
/* I will wait for you*/#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <algorithm>#include <iostream>#include <fstream>#include <vector>#include <queue>#include <deque>#include <map>#include <set>#include <string>#include <bitset>#define make make_pair#define fi first#define se secondusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair<int,int> pii;const int maxn = 100010;const int maxm = 1010;const int maxs = 26;const int inf = 0x3f3f3f3f;const int P = 1000000007;const double error = 1e-9;inline int read(){int x = 0, f = 1;char ch = getchar();while (ch <= 47 || ch >= 58)f = (ch == 45 ? -1 : 1), ch = getchar();while (ch >= 48 && ch <= 57)x = x * 10 + ch - 48, ch = getchar();return x * f;}int n, ans, sum;bitset<2000000> a;int main(){n = read(), a[0] = 1;for (int i = 1; i <= n; i++) {int num; scanf("%d", &num);sum += num, a ^= (a << num);}for (int i = 1; i <= sum; i++)ans ^= a[i] * i;printf("%d\n", ans);return 0;}

0 0