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 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 ...
随机推荐
- L1-012 计算指数
真的没骗你,这道才是简单题 —— 对任意给定的不超过 10 的正整数 n,要求你输出 2n.不难吧? 输入格式: 输入在一行中给出一个不超过 10 的正整数 n. 输出格式: 在一行中按照格式 ...
- L1-004 计算摄氏温度
给定一个华氏温度F,本题要求编写程序,计算对应的摄氏温度C.计算公式:C=5×(F−32)/9.题目保证输入与输出均在整型范围内. 输入格式: 输入在一行中给出一个华氏温度. 输出格式: 在一行中按照 ...
- AFNetworking 遇到错误 Code=-1016 "Request failed: unacceptable content-type: text/plain"
在开发过程使用了AFNetworking库,版本2.x,先运行第一个官方例子(替换GET 后面的url即可): AFHTTPRequestOperationManager *manager = [AF ...
- PAIR PROJECTS 附加题
[附加题] 改进电梯调度的interface 设计, 让它更好地反映现实, 更能让学生练习算法, 更好地实现信息隐藏和信息共享. 答:首先,就原有的StopAtEach方法而言,此算法的实现既是非常低 ...
- swig的语法和用法
1.swig一般在js文件里引入方法: __inline(*.tpl),如下图所示 2.特殊用法 swig模板里套用swig模板,<link rel="import" hre ...
- Incremental Method
「遞增法」是符合電腦運作特性的方法.電腦執行程式,一次只做一個動作,完成了一件事才做下一件事.當一個問題太大太多時,化整為零.一個一個解決吧! 合抱之木,生於毫末:九層之臺,起於累土:千里之行,始於足 ...
- WebGL编程指南案例解析之加载纹理(贴图)
var vShader = ` attribute vec4 a_Position; attribute vec2 a_TexCoord; varying vec2 v_TexCoord; void ...
- Jmeter系列培训(1)--开山篇
一直以来,我们不断分享,有的人喜欢,也有的人不喜欢,这都没什么,喜欢的点个赞,留个言,不喜欢的就不看好了,今天我们继续,关于jmeter我们分享了很多工作遇到的问题的解决方案,但是很多 ...
- convertTo函数
前言 使用opencv常常会需要用到数据类型之间的转换,此时需要使用convertTo函数. 代码: cv::Mat samples; cv::Mat tdata; samples.convertTo ...
- ScrollView在布局中的作用
ScrollView就是滚动一个View,将View里面的内容滚动起来. 但是由于scroolview只能有一个孩子,因此我们可以在ScrollView中在定义一个布局. 这样的话,我们就会直接滚动整 ...