Find your present!

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3579    Accepted Submission(s): 2386

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.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<=200, and n is odd) at first. Following that, n positive integers will be given in a line. 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
5
1 1 3 2 2
3
1 2 1
0
 
Sample Output
3
2
位运算:
 #include <iostream>
using namespace std; int main(){
int n, num;
while(cin >> n && n != ){
int ans = ;
for(int i = ; i < n; i++){
cin >> num;
ans = ans ^ num;
}
cout << ans << endl;
}
return ;
}

hdu 1563 Find your present!的更多相关文章

  1. HDOJ(HDU) 1563 Find your present!(异或)

    Problem Description In the new year party, everybody will get a "special present".Now it's ...

  2. HDU 2095 find your present (2)

    HDU 2095 find your present (2) 解法一:使用set 利用set,由于只有一个为奇数次,对一个数进行查询,不在集合中则插入,在集合中则删除,最后剩下的就是结果 /* HDU ...

  3. hdu 1563简单异或Find your present!

    #include<stdio.h> int  main(){  int n,m,s;  while(scanf("%d",&n),n) {   s=0;   w ...

  4. hdu 2095 find your present (2) 位运算

    题意:找出现次数为奇数的数 xor运算 #include <cstdio> #include <iostream> #include <algorithm> usi ...

  5. HDU 2095 find your present (2) (异或)

    题意:给定n个数,让你找出那一个次数为1的. 析:由于题意说了,只有那一个数是奇数,所以其他的都是偶数,根据异或的性质,两个相同的数异或为0: 任何数和0异或得原数,可以很简单的做出这个题. 代码如下 ...

  6. HDU 2095 find your present (2) 动态链表

    解题报告:输入一个n,后面紧跟着输入n个数,输入的这n个数中,除了有一个数的个数为奇数外,其它的数的个数都是偶数个,现在要你找出这个个数为奇数的这个数. 看起来好像很简单的样子,不过,这题的重点不在这 ...

  7. HDU 2095 find your present (2)( 位运算 )

    链接:传送门 题意:给出n个数,这n个数中只有一种数出现奇数次,其他全部出现偶数次,让你找到奇数次这个数 思路:简单异或运算题 /*********************************** ...

  8. HDU题解索引

    HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsu ...

  9. hdu 4672 Present Day, Present Time 博弈论

    看了解题报告才知道怎么做!! 题意:有 N 堆石子和 M 个石子回收站,每回合操作的人可以选择一堆石子,从中拿出一些 放到石子回收站里(可以放进多个回收站,每个回收站可以使用无数次),但每个石子回收站 ...

随机推荐

  1. Memcached 拒绝服务漏洞

    漏洞名称: Memcached 拒绝服务漏洞 CNNVD编号: CNNVD-201401-176 发布时间: 2014-01-15 更新时间: 2014-01-15 危害等级:    漏洞类型:   ...

  2. 【转】让itunes下载加速的真正办法,转向至香港台湾澳门苹果服务器 -- 不错不错!!!

    原文网址:http://bbs.feng.com/read-htm-tid-2397269.html 今天,看了一个这个帖子是改dns的,http://bbs.feng.com/read-htm-ti ...

  3. c#中字符串截取使用的方法

    AndyZhang welcome to java world c#中字符串截取使用的方法 String substring(int beginIndex) String substring(int ...

  4. android webview 访问https页面 SslError 处理

    在Android中,WebView可以用来加载http和https网页到本地应用的控件.但是在默认情况下,通过loadUrl(String url)方法,可以顺利loadUrl(“http://www ...

  5. loadrunner SQL2008

    1. 下载 JDBC 驱动(sqljdbc4.jar) 2. 在 run-time setting 下的 classpath 把 JDBC 驱动引入 /* * LoadRunner Java scri ...

  6. [CCC 1996 01]Deficient, Perfect, and Abundant

    CCC加拿大高中生信息学奥赛 其余来源 CODEVS[3312]——CCC 1996 01 Deficient, Perfect, and Abundant ——http://codevs.cn/pr ...

  7. [CODEVS1048]石子归并

    时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题目描述 Description 有n堆石子排成一列,每堆石子有一个重量w[i], 每次合并可以合并相邻的两堆石子 ...

  8. 【CSS】Beginner2:Selectors, Properties, and Values

    1.Whereas HTML has tags,CSS has selectors.   2.Selector{ properties:value; properties2:value2; }   3 ...

  9. oracle 实例名和服务名以及数据库名区别

    一.数据库名什么是数据库名?数据库名就是一个数据库的标识,就像人的身份证号一样.他用参数DB_NAME表示,如果一台机器上装了多全数据库,那么每一个数据库都有一个数据库名.在数据库安装或创建完成之后, ...

  10. 除去重复记录distinct

    在查询数据库时候,可以使用distinct关键字过滤重复记录 例如 SELECT distinct ShiftID FROM [AdventureWorks].[HumanResources].[Em ...