http://acm.hdu.edu.cn/showproblem.php?pid=2095
和google入围赛的一道题一摸一样啊!
View Code
#include
<
iostream
>
using namespace std;
int sum ,a;
int n , i;
int main()
{
while (scanf( " %d " , & n) != EOF, n)
{
sum = 0 ;
for (i = 0 ;i < n;i ++ )
{
scanf( " %d " , & a);
sum = sum ^ a;
}
printf( " %d\n " ,sum);
}
return 0 ;
}
using namespace std;
int sum ,a;
int n , i;
int main()
{
while (scanf( " %d " , & n) != EOF, n)
{
sum = 0 ;
for (i = 0 ;i < n;i ++ )
{
scanf( " %d " , & a);
sum = sum ^ a;
}
printf( " %d\n " ,sum);
}
return 0 ;
}