【PAT甲级】1041 Be Unique (20 分)(多重集)
题意:
输入一个正整数N(<=1e5),接下来输入N个正整数。输出第一个独特的数(N个数中没有第二个和他相等的),如果没有这样的数就输出"None"。
AAAAAccepted code:
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
multiset<int>st;
int a[];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
for(int i=;i<=n;++i){
cin>>a[i];
st.insert(a[i]);
}
for(int i=;i<=n;++i)
if(st.count(a[i])==){
cout<<a[i];
return ;
}
cout<<"None";
return ;
}
【PAT甲级】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 甲级 1041. Be Unique (20) 【STL】
题目链接 https://www.patest.cn/contests/pat-a-practise/1041 思路 可以用 map 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 ...
- 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 (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) 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 分)
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 th ...
- PAT 甲级 1073 Scientific Notation (20 分) (根据科学计数法写出数)
1073 Scientific Notation (20 分) Scientific notation is the way that scientists easily handle very ...
- PAT 甲级 1050 String Subtraction (20 分) (简单送分,getline(cin,s)的使用)
1050 String Subtraction (20 分) Given two strings S1 and S2, S=S1−S2 is defined to be t ...
- PAT 甲级 1046 Shortest Distance (20 分)(前缀和,想了一会儿)
1046 Shortest Distance (20 分) The task is really simple: given N exits on a highway which forms a ...
随机推荐
- sqlldr总结参数介绍
有效的关键字: userid -- ORACLE username/password control - 控制文件 log - 记录的日志文件 * 表示 ...
- win api + ffmpeg 播放 mp3 音乐
暂时记录,还有很多需要改善的地方一直没弄好,比如不知道怎么对上正确的播放速度. 有一些多余的代码,不用在意. #include <iostream> #include <fstrea ...
- python 中模块的版本号
查看所使用的模块的版本号,以numpy为例 import numpy numpy.__version__ 查看help(numpy)时,信息太多,不想看了,如何退出,按q,即可.
- arcgis字段计算器
arcgis字段计算器 一.VB脚本 1.取某字段前几位或者后几位 ) ) 2.合并字段,中间加符号 Dim a if [ZDDM2] ="" Then a= [ZDDM1] el ...
- [Java] 多线程基础详细总结,附加详细实例
详细代码在文章底部 目录 基础概念 进程与线程 单线程与多线程 实现线程的4中方式 thread.start()和runnable.run()的区别 Thread和Runnable的异同 线程的基本操 ...
- python正则元字符的含义
练习的时候使用linux+ipython,ipython安装 python的元字符 # 元字符 :# . ^ $ * + ? {} [] \ | () 注:\w ...
- auto_prt的VS版本源码剖析
通过对VC版本的auto_ptr的源代码得知VC版本还有一点小缺陷,又对VS版本的auto_ptr做了一些剖析,具体代码和注释如下: //假设全局pa2都是用pa1来构造 //如:pa2(pa1).p ...
- jsoup学习待续
1.Jsoup简介 Jsoup是一个java html解析器.它是一个用于解析HTML文档的java库.Jsoup提供api来从URL或HTML文件中提取和操作数据.它使用DOM,CSS和类似 Jqu ...
- bugku web 5
首先进入网站http://123.206.87.240:8002/web5/index.php 进入之后就会看到 然后点击F12就会打开后台 然后就会发现有一串东西就是这个然后经过搜索是jsfuck ...
- AcWing 860. 染色法判定二分图
#include <cstring> #include <iostream> #include <algorithm> using namespace std; , ...