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 ...
随机推荐
- NTP服务和DNS服务
1.NTP时间服务器 作用:NTP主要用于对计算机的时间同步管理操作 1.1 NTP部署 服务端:192.168.16.6 客户端:192.168.16.7 [root@localhost ~]# ...
- pytest以函数形式的测试用例
from __future__ import print_function#pytest以函数形式形成测试用例def setup_module(module): print('\nsetup_modu ...
- Android布局之相对布局——RelativeLayout
此博文主要是相对布局xml属性的解析及实例. android:layout_above:此控件底部的边缘位于设定ID控件的上方 <Button android:id="@+id/btn ...
- c++值传递和引用及指针传递区别
以下程序各有何问题? ***************************************************************************************** ...
- Laya 利用JS进行反射
Laya 利用JS进行反射 @author ixenos 当需要配表调用函数时,可以利用js的eval来调用 1.在配置js中写下: function callAsFunc(funcName){ ev ...
- C#中将数字金额转成英文大写金额的函数
<span style="white-space:pre"> </span>/// <summary> /// 数字转金额大写 /// 调用示例 ...
- 16 个常用的yum 命令
1. yum [-y] install package_name2. yum remove package_name 卸载指定软件3. ...
- 无向图生成树计数 基尔霍夫矩阵 SPOJ Highways
基尔霍夫矩阵 https://blog.csdn.net/w4149/article/details/77387045 https://blog.csdn.net/qq_29963431/articl ...
- [Noip复习知识点][个人向]Zackzh
只是列列一些要复习的,努力复习吧,有种noip退役的赶脚. 一.模拟 (这你也不会?退役吧) 二.DP 1.基础dp 2.区间dp 3.状压dp 4.树形dp 6.概率(期望)dp 7.环形dp 8. ...
- Trac常用插件描述! - wang_xf的Study home - 博客频道 - CSDN.NET
Trac常用插件描述! - wang_xf的Study home - 博客频道 - CSDN.NET