比赛 “Asm.Def战记之拉格朗日点”杯 评测结果 WWWWWWWWWW
题目名称 Asm.Def的微小贡献 最终得分 0
用户昵称 Collor 运行时间 2.650 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2015-11-04 11:51:25
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>
using namespace std;
const int maxn=1045;
int n,a[maxn],s[maxn],top=0;
void init()
{
	memset(s,0,sizeof(0));
	cin>>n;
	for (int i=1;i<=n;i++) 
		scanf("%d",&a[i]);
	//exit(0);
}
void dfs(int d,int sum)
{
	if (sum==0) {
		printf("%d\n",top);
		for (int i=1;i<=top;i++)
			printf("%d ",a[s[i]]);
		cout<<'\n';
		exit(0);
	}
	int temp;
	for (int i=d+1;i<=n;i++) {
		temp = sum xor a[i];
		s[++top]=i;
		dfs(i,temp);
		top--;
	}
}
int main()
{
	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 = sum ^ 21;
	printf("******\n%d\n*****\n",sum);
	sum = 23 ^ 17 ^ 19 ^ 10 ^ 26 ^ 10;
	printf("%d\n",sum);6 21 0*/
	int sum=0;
	for (int i=1;i<=n;i++){
		sum = a[i];
		s[++top]=i;
		dfs(i,sum);
		top--;
		
	}
	return 0;
}