hdu 2095
来源:互联网 发布:db2数据库的hadr 编辑:程序博客网 时间:2024/06/06 12:58
find your present (2)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/1024 K (Java/Others)Total Submission(s): 11293 Accepted Submission(s): 4128
Problem Description
In the new year party, everybody will get a "special present".Now it's your turn to get your special present, a lot of presents now putting on the desk, and only one of them will be yours.Each present has a card number on it, and your present's card number will be the one that different from all the others, and you can assume that only one number appear odd times.For example, there are 5 present, and their card numbers are 1, 2, 3, 2, 1.so your present will be the one with the card number of 3, because 3 is the number that different from all the others.
Input
The input file will consist of several cases.
Each case will be presented by an integer n (1<=n<1000000, and n is odd) at first. Following that, n positive integers will be given in a line, all integers will smaller than 2^31. These numbers indicate the card numbers of the presents.n = 0 ends the input.
Each case will be presented by an integer n (1<=n<1000000, and n is odd) at first. Following that, n positive integers will be given in a line, all integers will smaller than 2^31. These numbers indicate the card numbers of the presents.n = 0 ends the input.
Output
For each case, output an integer in a line, which is the card number of your present.
Sample Input
51 1 3 2 231 2 10
Sample Output
32use scanf to avoid Time Limit ExceededHintHint
Author
8600
Source
HDU 2007-Spring Programming Contest - Warm Up (1)
Recommend
8600
//由于题意说只有一个数出现奇数次,说明其他数都是偶数次。//于是用异或运算符,同一个数偶数次异或是0,奇数次异或就是本身。#include <stdio.h>int main(){int n, i, a, r;while(~scanf("%d", &n), n){r = 0;for(i = 0; i < n; i++){scanf("%d", &a);r ^= a;}printf("%d\n", r);}return 0;}
- hdu 2095
- hdu 2095
- HDU 2095
- HDU-2095
- hdu 2095
- HDU 2095
- HDU 2095
- hdu 2095
- HDU 2095(map)
- hdu 2095 map水
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- Continuation 和高级流程控制
- linux安装eclipse报错:cannot restore segment prot after reloc: Permission denied
- 传智播客
- Android、JUnit深入浅出(一)——JUnit初步解析
- C++初始化函数列表
- hdu 2095
- 支持向量机SVM(一)
- 输出n对括号的所有有效(左右括号成对匹配)排列
- 十六进制与十进制互转
- .Net图表开发控件Chart FX试用感受
- 支持向量机SVM(二)
- 推荐给开发人员的实用命令行工具
- php学习笔记(二十五)php中cookie的使用和控制
- C# asp.net 中关于配置文件的配置和作用(数据库部分)