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. [LeetCode#55, 45]Jump Game, Jump Game II

    The problem: Given an array of non-negative integers, you are initially positioned at the first inde ...

  2. bzoj1036

    树链剖分的基本题详细介绍在http://blog.sina.com.cn/s/blog_7a1746820100wp67.html通过树链剖分我们就可以在树上做线段树操作,完成解答 ; type no ...

  3. Linux Shell编程(7)——变量赋值

    =赋值操作符(它的左右两边不能有空白符) 不要搞混了=和-eq,-eq是比赋值操作更高级的测试.注意:等于号(=)根据环境的不同它可能是赋值操作符也可能是一个测试操作符.例子:简单的变量赋值 #!/b ...

  4. HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)

    Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  5. select的使用(一)

    单表操作 select Name,Major,InDate from T_Employee as 计算结果 select Name as 姓名,Major,InDate from T_Employee ...

  6. WebBrowser控件默认使用IE9,IE10的方法

    1,打开注册表 HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)     SOFTWARE        Microsoft           Internet E ...

  7. datagridview bindingsource

    调用bindindsource的ResetBindings() 方法

  8. 用Processon在线绘制UML的尝试

    地址https://www.processon.com/ ProcessOn是一个面向垂直专业领域的作图工具和社交网络,成立于2011年6月并于2012年启动.ProcessOn将全球的专家顾问.咨询 ...

  9. [Hibernate] 基本增删查改

    本文记录,Java 应用通过 Hibernate 对数据库 MySQL 进行基本的增删改查操作,即CRUD. 本例子的目录结构如下 hibernate.cfg.xml 存储数据库信息,如数据库类型,账 ...

  10. 编写Lex和Yacc

    大学课程设计中,有一次是编写Lex(词法分析器的生成器)和Yacc(语法分析器的生成器),编写这类工具软件不是一件容易的事情.这篇文章记录了当时编程时候的主要思想,主要还是编译原理的思想. 准备 Le ...