pat(A)1041. Be Unique(哈希)
1.链接:点击打开链接
2.代码:
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std; int a[100005];
int Hash[100000]; int main()
{
int n;
while(scanf("%d",&n)==1)
{
memset(Hash,0,sizeof(Hash));
for(int i=0; i<n; i++)
{
scanf("%d",&a[i]);
Hash[a[i]]++;
}
int flag=-1;
for(int i=0; i<n; i++)
{
if(Hash[a[i]]==1)
{
flag=i;
break;
} }
if(flag==-1)
printf("None\n");
else
printf("%d\n",a[flag]);
}
return 0;
}
pat(A)1041. Be Unique(哈希)的更多相关文章
- 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甲 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 de ...
- PAT甲级——1041 Be Unique
1041 Be Unique Being unique is so important to people on Mars that even their lottery is designed in ...
- 【PAT】1041. Be Unique (20)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...
- PAT 甲级 1041 Be Unique
https://pintia.cn/problem-sets/994805342720868352/problems/994805444361437184 Being unique is so imp ...
- 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 1041 Be Unique (20) [Hash散列]
题目 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 ...
随机推荐
- windows10下Anaconda的安装与tensorflow、opencv的安装与环境配置
刚开始学习tensorflow和opencv这一块的知识,所以用博客这个平台来把自己这段学习的经历与感想写下来. tensorflow和opencv则用Anaconda来下载和配置环境. 下载Anac ...
- [CF] 950A Left-handers, Right-handers and Ambidexters
A. Left-handers, Right-handers and Ambidexters time limit per test1 second memory limit per test256 ...
- vue-loader 细节
vue-loader 能根据 .vue 文件,导入一个vue组件.我这里从 vue-cli 的构建项目中抽取了vue-loader 一个小例子出来:vuedemo/demo02 vue-loader ...
- 条款34:区分接口继承和实现继承(Different between inheritance of interface and inheritance of implemenation)
NOTE: 1.接口继承和实现继承不同.在public继承之下,derived classes总是继承base class的接口. 2.pure virtual 函数只具体指定接口继承及缺省实现继承. ...
- PHP 配置文件php.ini文件优化
PHP 5.3.3 safe_mode = On #控制php中的函数执行比如system() 这个函数可以调用系统目录 比如 rm ,打开这个配置之后,同时把很多文件操作的函数进行了权限控制 saf ...
- IntrospectorCleanupListener监听器防止内存溢出
<listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</ ...
- 学习JSON
JSON:JavaScript Object Notation,轻量级的文本数据交换格式 .是存储和交换文本信息的语法.类似XML.但 JSON比XML更小.更快,更易解析.JSON使用Java ...
- AI学习笔记(02)
AI学习笔记 第一个黑箭头是用于挑选物体和移 动物体.在绘图是选中一个物体,就可以将它自由的移动.和其他的绘图软件相同当你选 中物体的时候物体周围就会出现八个方形的控制点,你可以通过这些控制点对物 ...
- hrbust-1909理工门外的树,不用线段数,贪心思路~~
理工门外的树 Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 605(125 users) Total Accepted: 154(11 ...
- 让你的 CDN 费用省 50% 以上!图片瘦身的正确姿势
七牛云新推出的图片瘦身功能是做什么的? 打开七牛云的「数据处理」中的「图片瘦身」功能,在图片受到访问时,能够实时对图片进行瘦身,在保证分辨率和画质不变的情况下,可以将图片最高缩小 80%.当「图片瘦身 ...