题目
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3432
题意
给2n-1个字符串,其中有n对相同的字符串,求剩下的那个字符串
解法
根据异或的性质,用第一个串与后面每一个串按位异或,即为所得
代码
#include <cstdio>
int main() {
int n;
char a[10], b[10];
while(~scanf("%d\n", &n)) {
gets(a);
for(int i = 0; i < n * 2 - 2; i++) {
gets(b);
for(int j = 0; j < 7; j++)
a[j] ^= b[j];
}
printf("%s\n", a);
}
return 0;
}