题目描述
Find a number which is repeated odd times, then You should output the number.
Example 1:
if input is:12 12 12 12 15
then output is: 15
Example 2:
if input is:12 13 12 13 18 12 13 13 18
then output is: 12
输入
First line contains a positive integer N < 500000 ,then, N positive integers follow (delimited with space) each less than 1 000 000.
输出
In input sequence only one number X is repeated odd times. Others have even number of occurrences. You should output X.
样例输入
9
3 1 2 2 17 1 3 17 3
样例输出
3
提示
Find a number which is repeated odd times, then You should output the number.
Example 1:
if input is:12 12 12 12 15
then output is: 15
Example 2:
if input is:12 13 12 13 18 12 13 13 18
then output is: 12
输入
First line contains a positive integer N < 500000 ,then, N positive integers follow (delimited with space) each less than 1 000 000.
输出
In input sequence only one number X is repeated odd times. Others have even number of occurrences. You should output X.
样例输入
9
3 1 2 2 17 1 3 17 3
样例输出
3
提示
If you can avoid error "Memory Limit Exceed", this problem will be a very simple problem.
思路:位运算中的异或运算符,2个数字异或则为0;