博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 1563 【Find your present!】
阅读量:4991 次
发布时间:2019-06-12

本文共 1370 字,大约阅读时间需要 4 分钟。

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
 

 找不同。。。。用数组超时,只得位运算

1 #include
2 using namespace std; 3 int main() 4 { 5 int N=0,result=0,num=0; 6 while(true) 7 { 8 cin>>N; 9 if(N==0)10 break;11 else12 {13 for(int i=0; i
>num;16 result=result^num;17 }18 cout<
<

 

转载于:https://www.cnblogs.com/castledrv/p/3667127.html

你可能感兴趣的文章
VIM学习笔记一
查看>>
面向对象第四单元总结
查看>>
同源策略,Jsonp实现跨域
查看>>
二叉搜索树的后序遍历序列
查看>>
纯C#的ini格式配置文件读写
查看>>
每日分享
查看>>
【干货】大数据框架整理
查看>>
年轻人,能用钱解决的,绝不要花时间(转)
查看>>
python2.7.X 升级至Python3.6.X
查看>>
VS调试方法
查看>>
jquery拖拽实现UI设计组件
查看>>
javamail模拟邮箱功能获取邮件内容-中级实战篇【内容|附件下载方法】(javamail API电子邮件实例)...
查看>>
白话排序算法--冒泡排序
查看>>
imx6 18bit display
查看>>
Spring静态属性注入
查看>>
实验10:指针2
查看>>
【转】hibernate缓存:一级缓存和二级缓存
查看>>
第二个spring冲刺第3天
查看>>
AwSnap:让全版本(Windows、iOS、Android)Chrome浏览器崩溃的有趣漏洞
查看>>
线段树合并学习笔记
查看>>