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. BAT 批处理实现循环备份N天文件夹

    @echo off set today=%date:~0,4%%date:~5,2%%date:~8,2% xcopy  /E /I E:\aaa e:\test\%today% for /f &qu ...

  2. 【HDOJ】2319 Card Trick

    水题,STL双端队列. /* 2319 */ #include <iostream> #include <cstdio> #include <cstring> #i ...

  3. 【模拟】Codeforces 699A Launch of Collider

    题目链接: http://codeforces.com/problemset/problem/699/A 题目大意: 给N个点,向左或向右运动,速度均为1,问最早什么时候有两个点相撞.无解输出-1 题 ...

  4. IIS7.0出错的解决方案 IIS 状态代码:IIS详细错误代码以及解释

    一.请求筛选模块被配置为拒绝包含双重转义序列的请求.HTTP 错误 404.11 - Not Found   1.单击 开始 . 在 开始搜索 框中, 键入 Notepad. 右击 记事本 , 然后单 ...

  5. SharePoint Server 2007 Enterprise Key

    正式版 key SN: Tkjcb-3wkhk-2ty2t-qymk2-9xm2y 这个版本也是通过Key来区分是否是测试版还是正式版的 也就是说你输入正式版的Key他就是正式版,输入Enterpri ...

  6. 《A First Course in Probability》-chape6-随机变量的联合分布-基本概念

    之前我们探讨了一元随机变量的分布列,下面我们应该将相应的性质推广到多元随机变量的分布列,在这里我们主要以讨论二元随机变量分布列为主. 利用类比的方法,我们很容易将一元随机变量的分布列的性质推广上来. ...

  7. python 代码格式化工具:autopep8

    学习资料: https://github.com/hhatto/autopep8 背景 autopep8 会根据 PEP 8 样式文档来格式化 python 代码.它使用 pep8 来决定代码的哪部分 ...

  8. poj1023

    题目大意:有趣的数字系统 在一个k位的2的补码,,位的索引是从0到k-1位的,值是-2^(k-1),其他位置的i是2^i( (0 ≤ i < k-1) ),例如,3位的数字101是-2^2 + ...

  9. IntelliJ IDEA安装 一些配置

    idea 配置修改 本篇 参考https://blog.liyang.io/234.html. 1.修改IDEA菜单的字体大小: 单击File | Project Structure菜单项,打开Pro ...

  10. Python随机生成验证码的两种方法

    Python随机生成验证码的方法有很多,今天给大家列举两种,大家也可以在这个基础上进行改造,设计出适合自己的验证码方法方法一:利用range Python随机生成验证码的方法有很多,今天给大家列举两种 ...