Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on a unique number wins. For example, if there are 7 people betting on 5 31 5 88 67 88 17, then the second one who bets on 31 wins.

Input Specification:

Each input file contains one test case. Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets. The numbers are separated by a space.

Output Specification:

For each test case, print the winning number in a line. If there is no winner, print "None" instead.

Sample Input 1:

7 5 31 5 88 67 88 17

Sample Output 1:

31

Sample Input 2:

5 888 666 666 888 888

Sample Output 2:

None
 #include <iostream>
#include <set>
using namespace std; int main(){
int n;
int i,t;
cin>>n;
set<int> s,s1;
int record[n];
cin>>t;
s.insert(t);
s1.insert(t);
record[] = t;
for(i = ; i < n; i++){
cin>>t;
record[i] = t;
if(s1.find(t) != s1.end() && s.find(t) != s.end()){
s.erase(t);
}
else if(s1.find(t) == s1.end()){
s.insert(t);
s1.insert(t);
} }
if(s.empty()){
cout<<"None";
}else{
i = ;
while(s.find(record[i]) == s.end()){
i++;
}
cout<<record[i]<<endl;
}
return ;
}

PAT-1041 Be Unique的更多相关文章

  1. PAT 1041 Be Unique[简单]

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  2. pat 1041 Be Unique(20 分)

    1041 Be Unique(20 分) Being unique is so important to people on Mars that even their lottery is desig ...

  3. PAT 1041 Be Unique (20分)利用数组找出只出现一次的数字

    题目 Being unique is so important to people on Mars that even their lottery is designed in a unique wa ...

  4. PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...

  5. PAT 甲级 1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  6. PAT甲 1041. Be Unique (20) 2016-09-09 23:14 33人阅读 评论(0) 收藏

    1041. Be Unique (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Being uniqu ...

  7. PAT 甲级 1041 Be Unique (20 分)(简单,一遍过)

    1041 Be Unique (20 分)   Being unique is so important to people on Mars that even their lottery is de ...

  8. PAT甲级——1041 Be Unique

    1041 Be Unique Being unique is so important to people on Mars that even their lottery is designed in ...

  9. 1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  10. 【PAT】1041. Be Unique (20)

    题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...

随机推荐

  1. 详解SSH注解配置,bean注解、事物注解等

    使用过SSH注解的屌丝们都知道,要想使用注解需要在applicationContext.xml配置文件里面开启注解配置,开启方式如下:1.头部声明需加入xmlns:context="http ...

  2. Lua开发环境配置

    Lua(英语发音:/ˈluːə/)程序设计语言是一个简洁.轻量.可扩展的脚本语言,是葡萄牙语中“Luna”(月亮)的意思. Lua is a powerful, fast, lightweight, ...

  3. 【HDOJ】2217 Visit

    挺好的一道DP. /* 2217 */ #include <iostream> #include <cstdio> #include <cstring> #incl ...

  4. WordPress /wp-admin/users.php畸形s参数路径泄漏漏洞

    漏洞版本: WordPress 2.7.x WordPress 2.8.x WordPress 2.9.x WordPress 3.0.x WordPress 3.1.x WordPress 3.2. ...

  5. 工资表的生成、显示、修改工资,应用transactionscope 分布式事务

    一: 二:SalarySheetDAL.cs using System; using System.Collections.Generic; using System.Linq; using Syst ...

  6. android导入项目出错处理

    问题: 执行Import-Android下的Existing Android Code Into Workspace 解决方法:

  7. 二次战CPP链表

    Felling By Ruiy: Pre-learnning link list knowloages 熟悉 指针相关操作应用+结构体数据类型应用,且能简单融合使用,堆内存(内存泄露)->类似于 ...

  8. Selenium webdriver 操作chrome 浏览器

    Step1: 下载chromedriver. 下载路径: http://chromedriver.storage.googleapis.com/index.html 选择一个合适的下载即可.我下载的是 ...

  9. 浅谈异步IO各模型优缺点

    本文只讨论OverLapped I/O的三种异步模型及完成端口,像select.SWASelect不作讨论,讨论顺序从劣到优,方便于循序渐进地对比,更容易区分各模型之间的差别. 1. OverLapp ...

  10. 双系统如何正确的使用修复BCD工具分享

    安装双系统时候,用于种种原因会导致开机启动只显示一个系统,此时需要修复下BCD即可. 下面介绍下两个修复BCD工具软件: 1.easybcd(双系统引导修复工具) v2.2.0.182 汉化版 下载地 ...