显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>
using namespace std;
const int maxn=1045;
long long a[maxn],s[maxn];
int n,top=0;
void init()
{
memset(s,0,sizeof(0));
cin>>n;
for (int i=1;i<=n;i++)
scanf("%lld",&a[i]);
//exit(0);
}
void dfs(int d,long long sum)
{
//printf("\n%d****第%d层\n",sum,d);
if (sum==0) {
printf("%d\n",top);
for (int i=1;i<=top;i++)//
printf("%d ",s[i]);
cout<<'\n';
//int k = 16 xor 10;
//printf("%d %d\n",k,sum);
exit(0);
}
long long temp;
for (int i=d+1;i<=n;i++) {
temp = sum xor a[i];
//printf("sum=%d %d a[%d]=%d cen=%d\n",sum,temp,i,a[i],d);
s[++top]=i;
dfs(i,temp);
top--;
}
//printf("%d****第%d层\n\n",sum,d);
}
int main()
{
long long sum=0;
freopen("asm_contribute.in","r",stdin);
freopen("asm_contribute.out","w",stdout);
init();/*
sum = 23 xor 17 xor 19 xor 21;
printf("%d\n",sum);
sum = 23 ^ 17;
printf("******\n%d\n*****\n",sum);
sum = sum ^ 19;
printf("******\n%d\n*****\n",sum);
sum = 23 ^ 17 ^ 19 ^ 10 ^ 21 ^ 10;23 17 19 10 21 10
printf("%d\n",sum);6 21 0*/
/*sum = 1 ^ 2;
printf("******\n%d\n*****\n",sum);*/
for (int i=1;i<=n;i++){
sum = a[i];
s[++top]=i;
dfs(i,sum);
top--;
}
return 0;
}