:::---> a = b ^ c —-> c = a ^ b b = a ^ c,就是异或递推的关系。
http://acm.hdu.edu.cn/showproblem.php?pid=1287
View Code
// a = b ^ c —-> c = a ^ b b = a ^ c
#include"iostream"
#include"math.h"
using namespace std;
int main()
{
int n,i;
int a[1000];
char ch;
while(cin>>n)
{
for(i=0;i<n;i++)
scanf("%d",&a[i]);
int count=0;
char xx;
for(ch='A'; ch<='Z'; ++ch)
{
count=0;
for(i=0; i<n; i++)
{
xx=a[i]^ch;
if(xx<='Z'&& xx>='A') count++;
}
if(count==n) break;
}
for(i=0;i<n;i++)
{
printf("%c",a[i]^ch);
}
printf("\n");
}
return 0;
}