比赛 |
20170912 |
评测结果 |
AAATTTTTTA |
题目名称 |
平凡的数据范围 |
最终得分 |
40 |
用户昵称 |
TARDIS |
运行时间 |
6.082 s |
代码语言 |
C++ |
内存使用 |
0.40 MiB |
提交时间 |
2017-09-12 20:24:41 |
显示代码纯文本
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#define XLM
using namespace std;
const int maxn=10010;
long long n,val[maxn],ans;
//20
bool choosed[maxn];
void check(){
long long num=0;
for (int i=1;i<=n;i++) if (choosed[i]) num^=val[i];
ans=max(ans,num);
}
void dfs(int pos){
if (pos==n+1){
check();return;
}
choosed[pos]=1;
dfs(pos+1);
choosed[pos]=0;
dfs(pos+1);
}
void deal_20(){
dfs(1);
printf("%lld",ans);
}
int main(){
#ifdef XLM
freopen("xor_equ.in","r",stdin);
freopen("xor_equ.out","w",stdout);
#endif
scanf("%lld",&n);
for (int i=1;i<=n;i++) scanf("%lld",&val[i]);
deal_20();
}