CSUOJ 1217 Odd number of digit operations

Description

Given some numbers, only one of them occurs an odd number of times, find that number.

Input

The first row of each set of data n represents the number of numbers, 1 <= n <= 2 ^ 18 and n % 2 == 1.

Each of the next n lines contains a 32-bit signed integer.

Output

The number that appears an odd number of times corresponds to a row for each set of data.

Sample Input

5
1
1
2
2
3

7
1
2
1
2
2
3
3

Sample Output

3
2

Hint

use bitwise operations

#include<stdio.h>
intmain()
{
	int T;
	while (~scanf("%d", &T))
	{
		int x;
		int cnt = 0;
		while (T--)
		{
			scanf("%d", &x);
			cnt ^= x;	
		}
		
		printf("%d\n", cnt);
	}


	return 0;
}
/**********************************************************************
	Problem: 1217
	User: leo6033
	Language: C++
	Result: AC
	Time:416 ms
	Memory:1120 kb
**********************************************************************/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325997458&siteId=291194637