pat 1041 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 <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#define LL long long
using namespace std;
const int MAX = 1e5 + ; map <int, int> mp;
map <int, int> :: iterator iter;
int n, a, A[MAX]; int main()
{
// freopen("Date1.txt", "r", stdin);
scanf("%d", &n);
for (int i = ; i < n; ++ i)
{
scanf("%d", &a);
A[i] = a;
mp[a] ++;
} for (int i = ; i < n; ++ i)
{
if (mp[A[i]] == )
{
printf("%d\n", A[i]);
return ;
}
}
printf("None\n");
return ;
}
pat 1041 Be Unique(20 分)的更多相关文章
- PAT 1041 Be Unique (20分)利用数组找出只出现一次的数字
题目 Being unique is so important to people on Mars that even their lottery is designed in a unique wa ...
- 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 (20 分)(简单,一遍过)
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is de ...
- 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甲级】1041 Be Unique (20 分)(多重集)
题意: 输入一个正整数N(<=1e5),接下来输入N个正整数.输出第一个独特的数(N个数中没有第二个和他相等的),如果没有这样的数就输出"None". AAAAAccepte ...
- 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) 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[简单]
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...
- pat 1035 Password(20 分)
1035 Password(20 分) To prepare for PAT, the judge sometimes has to generate random passwords for the ...
随机推荐
- opencv实践::对象的提取
问题描述 真实案例,对图像中对象进行提取,获取这样对象,去掉其它干扰和非目标对象. 解决思路 二值分割 + 形态学处理 +横纵比计算 #include <opencv2/opencv.hpp&g ...
- windows与office激活
暴风官网:www.baofengjihuo.com
- ANSI最全介绍linux终端字体改变颜色等
ANSI转义序列 维基百科,自由的百科全书 由于国内不能访问wiki而且国内关于ANSI的介绍都是简短的不能达到,不够完整所以转wiki到此博客,方便国内用户参考,原地址(https://zh.wik ...
- 阿里巴巴开源故障注入工具_chaosblade
chaosblade是阿里巴巴最近开源的一款故障注入的工具,因为我最近在做公司的虚拟化平台的可靠性测试工具,无意中发现这个工具,个人感觉比较有用,用起来也比较简单,所以拿出来分享一下,期望对大家的工作 ...
- 玩转OneNET物联网平台之MQTT服务⑦ —— 远程控制LED(数量无限制)+ Android App控制 优化第一版
授人以鱼不如授人以渔,目的不是为了教会你具体项目开发,而是学会学习的能力.希望大家分享给你周边需要的朋友或者同学,说不定大神成长之路有博哥的奠基石... QQ技术互动交流群:ESP8266&3 ...
- 面试题-javascript-面向对象编程
笔者在某次笔试中遇到这个题:印象很深. function ClassA() { var value=4; this.getValue= function() { return value; } thi ...
- 使用SQLserver Management Studio连接VS2012自带数据库
下载 Microsoft® SQL Server® 2008 Management Studio Express http://www.microsoft.com/zh-CN/download/det ...
- QlikSense 2018.2月版起支持主题开发
自定义主题开发 // 主题是qliksense 2018年2月版提出,4月版正式实施,其实就是去修改sense默认的.json文件和.css文件 { // 定义自定义主题是否从默认主题(Sense C ...
- SpringBoot整合MybatisPlus3.X之SQL执行分析插件(十四)
pom.xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId& ...
- Window 同时安装Python2和Python3 终极版
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/vitaminc4/article/det ...