pat1041. Be Unique (20)
1041. Be Unique (20)
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<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<queue>
#include<vector>
#include<cmath>
#include<string>
#include<map>
#include<set>
using namespace std;
int num[];
int main(){
int n;
scanf("%d",&n);
memset(num,,sizeof(num));
vector<int> v;
int i,in;
for(i=;i<n;i++){
scanf("%d",&in);
num[in]++;
v.push_back(in);
}
for(i=;i<v.size();i++){
if(num[v[i]]==){
break;
}
}
if(i==v.size()){
printf("None\n");
}
else{
printf("%d\n",v[i]);
}
return ;
}
pat1041. Be Unique (20)的更多相关文章
- PAT1041: Be Unique
1041. Be Unique (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Being uniqu ...
- 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 ...
- PAT 甲级 1041 Be Unique (20 分)(简单,一遍过)
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is de ...
- 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 ...
- PAT-1041 Be Unique
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
- 1041. Be Unique (20)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
- 【PAT】1041. Be Unique (20)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...
- PAT Advanced 1041 Be Unique (20 分)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
- PAT Advanced 1041 Be Unique (20) [Hash散列]
题目 Being unique is so important to people on Mars that even their lottery is designed in a unique wa ...
随机推荐
- 多用户ATM机(面向对象编程)
let readline = require('readline-sync'); // 清屏函数 let clear = () => process.stdout.write(process.p ...
- 第一章:初识JAVA
一:计算机语言发展史 机器语言:典型的二进制文件和计算机交流. 汇编语言: 通过大量的标识符表示一些基本操作来和计算机做交流. 高级语言:通过常见的英语指令来编写程序,完成沟通 常见高级语言 Java ...
- Le x820 的刷机记录
一定要卡刷,如果用线刷,那些线刷宝等会内置好多应用. 卡刷的ROM包,都属于“民间包”,而官方的recovery,是不允许刷第三方包的.所以我们要先刷recovery.(刷入第三方recovery,还 ...
- JQuery判断页面是否按下了Enter键
$('#someTextBox').keypress(function(event){ var keycode = (event.keyCode ? event.keyCode : event.whi ...
- 网络流EdmondsKarp算法模板理解
先推荐一个讲网络流的博客,我的网络流知识均吸收于此 传送门 EdmondsKarp算法基本思想:从起点到终点进行bfs,只要存在路,说明存在增广路径,则取这部分路 权值最小的一部分,即为增广路径( ...
- POJ 3686 *最小费用流-转化成普通指派问题)
题意] 有N个订单和M个机器,给出第i个订单在第j个机器完成的时间Mij,每台机器同一时刻只能处理一个订单,机器必须完整地完成一个订单后才能接着完成下一个订单.问N个订单完成时间的平均值最少为多少. ...
- 上传文件中文文件名乱码的解决方法以及iconv函数的使用
http://www.jb51.net/article/14530.htm 一般客户端是什么格式就展示什么格式,比如浏览器的UTF-8,windows的GBK
- Qt中的标准对话框
1. Qt为开发者提供了一些可复用的对话框类型,如QMessageBox,QFileDialog,QPrintDialog, QColorDialog, QInputDialog, QProgress ...
- Ubuntu14.10:Install Apache,PHP,Mysql以及扩展库
step 1: Apache sudo apt-get install apache2 After have apache2 installed, go to localhost by browser ...
- 增加tomcat多实例
第一步:解压 第二步:修改端口 /data/service/tomcat1/conf <Server port="8006" shutdown="SHUTDOWN& ...