标签:
bitset很好用的样子?
1 #include<cstdio> 2 #include<cstdlib> 3 #include<algorithm> 4 #include<iostream> 5 #include<cstring> 6 #include<string> 7 8 using namespace std; 9 10 void setIO(const string& a) { 11 freopen((a + ".in").c_str(), "r", stdin); 12 freopen((a + ".out").c_str(), "w", stdout); 13 } 14 15 #include<bitset> 16 bitset<2000010> a; 17 18 int main() { 19 #ifdef DEBUG 20 freopen("in.txt", "r", stdin); 21 freopen("out.txt", "w", stdout); 22 #endif 23 24 int n, x, res = 0; 25 scanf("%d", &n); 26 a[0] = 1; 27 while(n--) { 28 scanf("%d", &x); 29 a ^= (a << x); 30 } 31 for(int i = 1; i <= 2000000; i++) { 32 if(a[i]) res ^= i; 33 } 34 printf("%d\n", res); 35 36 return 0; 37 }
标签:
原文地址:http://www.cnblogs.com/showson/p/5006747.html