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 ...
随机推荐
- ZooKeeper运行原理和基本编程接口
什么是ZooKeeper ZooKeeper作为一个分布式的服务框架(与Google Chubby类似),主要用于解决分布式集群中应用系统的一致性问题,它能提供基于类似于文件系统的目录节点树方式的数 ...
- [CF] 948A Protect Sheep
A. Protect Sheep time limit per test1 second memory limit per test256 megabytes inputstandard input ...
- Oracle数据库的基本使用
1.Linux安装 (略) 2.Oracle数据库监听命令: 监听状态:$lsnrctl status 启动监听:$lsnrctl start 关闭监听:$lsnrctl stop 重载监听:$l ...
- MyBatis的动态sql小练习,小回顾
关键字if+trim trim可以去除多余的关键字,是where和set的组合 trim标记是一个格式化的标记,可以完成set或者是where标记的功能,如下代码: <trim prefix=& ...
- h5 页面 禁止网页缩放
//禁用双指缩放: document.documentElement.addEventListener('touchstart', function (event) { if (event.touch ...
- 教你轻松在React Native中使用自定义iconfont
在react-native项目中我们一般使用到 react-native-vector-icons(这里不介绍如何使用react-native-vector-icons按照官方文档即可)但是当reac ...
- github私有库购买信息
github私有库购买信息 一年84美元. 换算成人民币是:532元. 话说其他开发者都买了么?
- react 语法细节总结说明
1.当要获取某个数据列表中的某个字段时,用“.”附加的形式.例如:获取user中的balance字段,用this.props.user.balance 来表示. 2.当要打印某个数据或字段结果时,co ...
- Python中input()和raw_input()函数的区别
问题:在Python2.7中使用 input() 函数会出现 “NameError: Name ”***“ is not defined 的错误 解决: 使用raw_input() 函数,在Pytho ...
- Android TransitionDrawable:过渡动画Drawable
Android TransitionDrawable实现一种可以用动画表示的Drawable.写一个例子. package zhangphil.app; import android.graphics ...