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. 通过 Azure 媒体管理门户开始使用直播流媒体

    Jason Suess Azure媒体服务首席项目经理 几个月前,我们宣布发布 Azure媒体服务直播服务的公共预览版.其实这些直播服务早已被美国国家广播公司体育台用于多项重大体育赛事的多平台直播 ...

  2. apache开源项目--lucence

    Lucene 是apache软件基金会一个开放源代码的全文检索引擎工具包,是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎.Lucene的目的是为软件开发人员提供一个简单易用 ...

  3. 使用Bugfree不应有的坏习惯

    Bugfree是一款优秀的bug管理和追踪工具,因此受到不少公司的青睐.但实际的工作中,我发现不少开发或是测试的同事有一些不好的使用习惯,使得我们对Bugfree的利用不够高效.我下面列出使用Bugf ...

  4. Servlet3.0学习总结(三)——基于Servlet3.0的文件上传

    在Servlet2.5中,我们要实现文件上传功能时,一般都需要借助第三方开源组件,例如Apache的commons-fileupload组件,在Servlet3.0中提供了对文件上传的原生支持,我们不 ...

  5. [Jacky] 解决Ext.Net GridPanel 选择的行数据刷新后不能获取最新值

    选择GridPanel中一行数据,当变更数据时并重新刷新之后不能获取最新值,需通过如下方式获取: var internalId = gridPanel.getSelectionModel().getL ...

  6. Android 不能勾选 Project Build Target

    再勾选完project bulid target,从新返回这个页面,发现还是没有被勾选上. 从新刷新一下项目,原因是project.properties配置文件没有加载上. 下回导入的项目第一件事就是 ...

  7. Mac OS X Mountain Lion安装Bochs

    基本步骤可以看这个帖子 http://hi.baidu.com/any_where/item/990c0acdfbd6542c47d5c003 大体是: 1.安装x11; 2.开启Mac OS X的r ...

  8. 只需三步:使用C# 操作 Azure 队列

    Step 1 : 安装windows Azure package Step 2 : 配置文件增加: <appSettings> <add key="StorageConne ...

  9. 一分钟快速入门openstack

    一.它是什么,能干什么想认识一个事物,必须先弄明白它是什么,能干什么.首先说一下,openstack是一个搭建云平台的一个解决方案,说他不是个软件,但是我觉得说是一个软件,能够让大家认识更清晰些.op ...

  10. HW4.6

    public class Solution { public static void main(String[] args) { final double MILES_PER_KILOGRAM = 1 ...