// hdoj_2095 find your present (2)
// 562MS 220K 230 B GCC
#include <stdio.h>
int main(void)
{
int i, n, x, s;
while(scanf("%d", &n), n)
{
s = 0;
for(i = 0; i < n; i ++)
{
scanf("%d", &x);
s ^= x;
}
printf("%d\n", s);
}
return 0;
}
while(scanf("%d", &n), n) 用到了逗号表达式
s ^= x; 用到了异或运算
百度百科:http://baike.baidu.com/view/674171.htm
1^1 = 0
1^0 = 1
0^1 = 1
0^0 = 0
本文详细介绍了HDOJ_2095题目的解题过程,利用异或运算解决实际问题,并通过实例深入探讨了其应用技巧。
268

被折叠的 条评论
为什么被折叠?



