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
分析:散列,水题
/**
* Copyright(c)
* All rights reserved.
* Author : Mered1th
* Date : 2019-02-25-20.44.45
* Description : A1041
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<unordered_set>
#include<map>
#include<vector>
#include<set>
using namespace std;
;
};
};
int main(){
#ifdef ONLINE_JUDGE
#else
freopen("1.txt", "r", stdin);
#endif
int n;
cin>>n;
;i<n;i++){
scanf("%d",&a[i]);
hashtable[a[i]]++;
}
int i;
;i<n;i++){
){
printf("%d",a[i]);
;
}
}
if(i==n) printf("None");
;
}
1041 Be Unique (20 分)的更多相关文章
- 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 Advanced 1041 Be Unique (20 分)
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分)利用数组找出只出现一次的数字
题目 Being unique is so important to people on Mars that even their lottery is designed in a unique wa ...
- 【PAT甲级】1041 Be Unique (20 分)(多重集)
题意: 输入一个正整数N(<=1e5),接下来输入N个正整数.输出第一个独特的数(N个数中没有第二个和他相等的),如果没有这样的数就输出"None". AAAAAccepte ...
- 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)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...
- 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) 【STL】
题目链接 https://www.patest.cn/contests/pat-a-practise/1041 思路 可以用 map 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 ...
随机推荐
- SWIFT中切換UIContainerView內的Controller
如下,一个UIContainerView内切换两个Controller,当点击登录的时候UIContainerView的视图为LoginController,当点击登记的时候UIContainerVi ...
- C# 历史曲线控件 基于时间的曲线控件 可交互的高级曲线控件 HslControls曲线控件使用教程
本篇博客主要对 HslControls 中的曲线控件做一个详细的教程说明,大家可以根据下面的教程开发出高质量的曲线控件 Prepare 先从nuget下载到组件,然后就可以使用组件里的各种组件信息了. ...
- linux C/C++服务器后台开发面试题总结
一.编程语言 1.根据熟悉的语言,谈谈两种语言的区别? 主要浅谈下C/C++和PHP语言的区别: 1)PHP弱类型语言,一种脚本语言,对数据的类型不要求过多,较多的应用于Web应用开发,现在好多互联网 ...
- pandas.read_csv 参数 index_col=0
index_col : int or sequence or False, default None 用作行索引的列编号或者列名,如果给定一个序列则有多个行索引. 如果文件不规则,行尾有分隔符,则可以 ...
- TJU Problem 2857 Digit Sorting
原题: 2857. Digit Sorting Time Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 3234 Accepted ...
- mvc之URL篇
一.根据路由系统生成友好的URL ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName); 会根据当前的路 ...
- http状态码301和302详解及区别——辛酸的探索之路(文章源自:http://blog.csdn.net/grandPang/article/details/47448395)
一直对http状态码301和302的理解比较模糊,在遇到实际的问题和翻阅各种资料了解后,算是有了一定的理解.这里记录下,希望能有新的认识.大家也共勉. 官方的比较简洁的说明: 301 redirect ...
- python type metaclass
在python中一切皆对象, 所有类的鼻祖都是type, 也就是所有类都是通过type来创建. 传统创建类 class Foo(object): def __init__(self,name): se ...
- ZOJ3545 Rescue the Rabbit
分析 未知定长串中不同已知模板串的出现次数问题,一般做法是AC自动机上dp. 考虑背包,\(dp(i,j,k)\)表示当前串长为\(i\),在AC自动机上对应节点\(j\),已匹配的模板串的状态为\( ...
- PostgREST docker-compose 试用
PostgREST 是一款很不错的直接将pg 数据库暴露为restapi ,使用了基于行级别安全访问控制, 比较全的restapi 查询以及集成了swagger openapi docker-comp ...