HDOJ 2095-find your present (2)
来源:互联网 发布:mac系统覆盖重装 编辑:程序博客网 时间:2024/05/16 16:17
find your present (2)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 19611 Accepted Submission(s): 7622
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
#include<iostream>#include<cstdio>using namespace std;int main(){ int n; int temp; while(scanf("%d",&n)==1) { if(!n) break; int ans,i; for(i=0,ans=0;i<n;i++) { scanf("%d",&temp); ans^=temp; } printf("%d\n",ans); } return 0;}
0 0
- HDOJ 2095 find your present (2)
- hdoj 2095 find your present (2)
- hdoj.2095 find your present (2) 20140804
- hdoj 2095 find your present (2)
- HDOJ 2095 find your present (2)
- HDOJ find your present (2) 2095
- HDOJ 2095 find your present (2)
- HDOJ 2095-find your present (2)
- HDOJ 2095 find your present (2)
- HDOJ 2095 find your present (2)
- hdoj 1563 Find your present!&&2095 Find your present(2) 异或运算
- hdoj 2095 find your present (2) 【位运算】
- hdoj-2095-find your present (2)【位异或】
- HDOJ 2095 find your present (2) 位运算
- hdoj 2095 find your present (2)【位运算,异或】
- HDOJ 2095 Find your present (2) 异或运算
- hdoj 2095 find your present (2)(异或运算)
- 异或的性质 HDOJ 2095 find your present (2)
- java用一行代码初始化ArrayList
- 《C++Primer 5e》学习笔记(4):语句
- phpstorm常用快捷键3
- 收集整理比较全 shell sed 命令与实例教程
- mybatis查询数据库返回结果为空
- HDOJ 2095-find your present (2)
- [android项目]开发过程中需要时刻注意的
- ubuntu批量修改文件
- nstimer你知多少
- 已经被iOS9无情的抛弃了的UIAlertView
- cocoapods pod install 卡死
- 【高斯消元】Poj 1222:EXTENDED LIGHTS OUT
- Virtualbox安装centos6.5系统时出错(提示VBoxDD.DLL错误不能为虚拟电脑打开一个新任务的解决办法
- Spherical Mercator