2014年10月5日 星期日

TIOJ 1094. C.幼稚國王的獎賞

1048576*30




#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<vector>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<cmath>
using namespace std;
typedef long long int int64;
bool exist[1048576];
int main()
{
 int n;
 for(;;){
  scanf("%d", &n);
  if(n == 0) break;
  memset(exist, 0, sizeof(exist));
  exist[0] = 1;
  for(int lx = 0;lx < n;lx++){
   int inp;scanf("%d\n", &inp);
   for(int rr = 0;rr < 1048576;rr++)
    if(exist[rr])
     exist[rr^inp] = 1;
  }
  int mm = 0;
  for(int lx = 0;lx < 1048576;lx++)
   if(exist[lx])
    mm = lx;
  printf("%d\n", mm);
 }
 return 0;
}

沒有留言:

張貼留言