1041. Be Unique (20)

时间限制
100 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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)的更多相关文章

  1. PAT1041: Be Unique

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

  2. 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 ...

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

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

  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

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

  6. 1041. Be Unique (20)

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

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

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

  8. 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. ...

  9. 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 ...

随机推荐

  1. docker网络模式----入门docker的难点

    众所周知,现在docker是轻量级虚拟化的典型代表!这段时间想要建立一个分布式系统,但是手头上主机没那么多,所以使用docker进行虚拟化,但是在使用的过程中对网络这一部分是一直不太理解,特别找了一篇 ...

  2. meta常用命令

    sessions -i 1用于查看你控制的电脑

  3. jmeter接口参数化获取tocken后保存批量保存在本地

    jmeter目录结构如下: 1,读取文件配置的ID提取tocken 2,CSV 数据文件设置,第一个为文件目录,第二个为参数化的参数名. 3,正则表达式提取tocken 4,BeanShell Pos ...

  4. 【探讨】linux环境,执行重启了php后php.ini依然不生效

    背景: 一个linux环境配置了多个php版本的环境,同时修改了多个php.ini,执行service php-fpm restart 之后,依然不生效 原因: 没有设置好启动php.ini 参考链接 ...

  5. mongoDB(1) -- 安装及开始

    安装完成后在/bin文件夹下打开命令窗口 输入.\mongo启动数据库,若正常启动说明安装成功: 为了启动mongodb方便,将mongod.exe路径加入环境变量,电脑->属性->高级系 ...

  6. HDU - 1166 敌兵布阵 方法一:(线段树+单点修改,区间查询和) 方法二:利用树状数组

    C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况.由于 ...

  7. 云端搭建Linux学习环境 链接https://edu.aliyun.com/article/19 (阿里云ECS服务器 )课堂

    云端搭建Linux学习环境 链接https://edu.aliyun.com/article/19 1. 开通云服务器 2 1.包年包月   按量付费(适合测试数据的时候) 2 2.地域   服务器数 ...

  8. 51nod1448(yy)

    题目链接: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1448 题意: 中文题诶~ 不过要仔细看题, 原来颜色是被覆盖 ...

  9. p2p-如何拯救k8s镜像分发的阿喀琉斯之踵?

    K8s的出现为PaaS行业的发展打了一针兴奋剂,Docker+k8s的技术路线已经成为了容器云的主流.尤其针对大流量,大弹性的应用场景来说,k8s将其从繁杂的运维.部署工作中彻底拯救出来.然而事情往往 ...

  10. log4j配置文件及java调用 每个级别输出到不同的文件

    #配置根Logger log4j.rootLogger = DEBUG , RollingFile,CONSOLE #文件大小达到一定尺寸的时候创建一个新的文件 log4j.appender.Roll ...