The number of the odd number of csuoj 1217

Source: Internet
Author: User
Description

Given some numbers, only one of these numbers appears an odd number and finds this number.

 

Input

The first line N of each group of data indicates the number of numbers, 1 <= n <= 2 ^ 18 and N % 2 = 1.

Each row in the next n rows contains a 32-bit signed integer.

 

Output

The number that appears for an odd number of times. Each group of data corresponds to a row.

 

Sample Input
51122371212233
Sample output
32

I read the code of the great god and used bitwise O (arithmetic □arithmetic) O

1 # include <stdio. h> 2 int main () 3 {4 int n, x, ans; 5 while (scanf ("% d", & N )! = EOF) 6 {7 ans = 0; 8 for (; n> 0; -- N) 9 {10 scanf ("% d", & X ); 11 ans ^ = x; 12} 13 printf ("% d \ n", ANS); 14} 15 return 0; 16}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.