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. 开发一个属于自己的第一个Composer/Packagist包

    Composer 给我们带来了诸多的好处: 模块化,降低代码重用成本 统一的第三方代码组织方式 更科学的版本更新 初始化项目,生成composer.json文件 初始实例项目代码目录结构: 现在要在项 ...

  2. eclipse workspace 共享设置

    总结一下,复制工作空间配置步骤如下: 1 使用eclipse新建workspace. 2 将新建的workspace下的.metadata\.plugins内容全部删除. 3 将需要拷贝的worksp ...

  3. dojo1.7 加载器

    原文地址:http://dojotoolkit.org/documentation/tutorials/1.7/modules/ dojo现在支持在异步模块异步(AMD)定义中加入模块写入功能了,这使 ...

  4. 用Pdg2.DLL解码PDG的境界

    作者:马健邮箱:stronghorse_mj@hotmail.com发布:2008.08.03 一.入门级原理:按照<用BCB实现超星格式转换为BMP格式>中说的方法调用Pdg2.DLL接 ...

  5. android studio中配置X5 webview时的一个坑

    在接入X5的第二步中,需要配置so文件,这里说一下遇到的坑 1. 需要把demo下载回来,不然你找不到so文件,找到so文件后放到自己相对应的目录下边,自己里面那个目录也没有,所以和文件夹一起复制过去 ...

  6. 用递归算法返回该元素id下面的所有子集id

    private List<int> listAreaId = new List<int>(); /// <summary> /// 递归获取本区域下面的所有子集 / ...

  7. Android下创建一个输入法

    输入法是一种可以让用户输入文字的控件.Android提供了一套可扩展的输入法框架,使得应用程序可以让用户选择各种类型的输入法,比如基于触屏的键盘输入或者基于语音.当安装了特定输入法之后,用户即可在系统 ...

  8. iOS开发之蓝牙使用-建立连接的

    1.大佬笔记 CSDN 2.代码 github

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

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

  10. ASP.NET-GridView之导出excel或word

    在CS阶段我们涉及到表格的导出,再Web开发同样可以实现,而且实现形式多种多样.以下面的例子说明表格导出到excel和word 这里用到了一个后台方法输出流形成***文件的的公共方法 DEMO < ...