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 ...
随机推荐
- PHP常用的服务器
Wordpress够流行了吧,它是一个用PHP编写的强大的博客平台.使用它来架设一个博客平台相关容易,是新手建站比较方便的工具.但是要真正体会Wordpress(以下简称WP)强大,插件是不可少的东西 ...
- 乱谈zip、rar文件格式
作者:马健邮箱:stronghorse_mj@hotmail.com发布:2006.11.21最近更新:2006.11.25 目录一.目录表(TOC)与分卷(Volume)二.固实(solid)压缩方 ...
- 动态绑数据(GridView控件Header和ItemTemplate)
想了解此篇文章,建议先预习一下<动态变更GridView控件列名>http://www.cnblogs.com/insus/p/3232057.html,因为多少有些关联.不管怎样,它能够 ...
- [hdu 1568] Fibonacci数列前4位
2007年到来了.经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2 ...
- hdu2328(后缀数组 + 二分)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2328 题意: 求 n 个串的字典序最小的最长公共子串 思路: 本题中单个字符串长度不超过 200, ...
- peaks
给定一个无向图,点有点权边有边权 Q次询问,每次询问从点v开始只经过边权<=x的边能到达所有点中点权第k大值,无解输出-1 N<=1e5,M,Q<=5e5 建立大根kruskal重构 ...
- mysql8.0的新特性
https://www.cnblogs.com/kevingrace/p/10482469.html MySQL 8 正式版 8.0.11 已发布,官方表示 MySQL 8 要比 MySQL 5.7 ...
- nginx+uwsgi01---flask部署
1.uwsgi.ini [uwsgi] # uwsgi 启动时所使用的地址与端口注意socket与http不同,http可以被外网访问0. socket = # 指向网站目录 chdir = /hom ...
- 小程序获取unionId以及手机号
1.前端小程序传入后端接口的入参如下: code :临时登录凭证(必传)encryptedData:密文iv:偏移量 2.接收到入参后的java后端接口中的代码如下: @Action(value = ...
- Drop user 报ORA-00600 [KTSSDRP1]
一客户删除一个数据库用户THH时报错: 说明在获取seg$时没有找到相应的条目,先来解释下这个600错误的参数含义: Arg [a] Tablespace number Arg [b] File nu ...