1041 Be Unique
题意:找到一串数字序列中首个出现的不重复的数字。
思路:用哈希,因为数值大小在[1,10^4],所以可以直接开数组。输入数据时记录每个数字出现过的次数。然后遍历原序列,遇到第一个次数为1的数字就是所求。
代码:
#include <cstdio>
]={};
];
int main()
{
int n,i;
scanf("%d",&n);
;i<n;i++){
scanf("%d",&data[i]);
cnt[data[i]]++;
}
;i<n;i++)
) break;
if(i==n) printf("None\n");
else printf("%d\n",data[i]);
;
}
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 ...
- 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[简单]
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...
- pat 1041 Be Unique(20 分)
1041 Be Unique(20 分) Being unique is so important to people on Mars that even their lottery is desig ...
- 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 (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)
题目链接: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. ...
随机推荐
- PHP的可变变量名
有时候可变的变量名会给编程带来很大的方便.也就是说变量名可以被动态的命名和使用.通常变量通过下面这样的语句来命名 : 1 2 3 <!--?php $a = 'hello'; ?--> 可 ...
- angularjs笔记(1)
https://github.com/angular/angular.js/blob/master/src/ng/q.js 1.ng-app 指令告诉 AngularJS,<div> 元素 ...
- Django进阶Model篇003 - 数据库同步技巧
一.认识一个目录 目录名:migrations 作用:用来存放通过makemigrations命令生成的数据库脚本,不熟悉的情况下,里面生成的脚本不要轻易修改.app目录下必须要有migrations ...
- 支付宝VIE的罪与罚
http://tech.ifeng.com/special/tusimple/alibaba/#_www_dt2 雅虎的杨致远.软银的孙正义,都曾是马云阿里巴巴创业路上的贵人,也都曾是相互信任的朋 ...
- Python globals() locals() vars() 三个内建函数的区别
首先参考官方文档对这三个函数的介绍: 2. Built-in Functions – Python3.5 1.globals() 返回当前全局符号表, 通常是返回当前模块下的全局符号表, 比如全局内建 ...
- Stylus的基础用法
介绍 在学习一个 Vue.js 项目的过程中,注意到源码中样式的部分并没有用熟悉的 .css 样式文件,而是发现了代码长得和 CSS 相像的 .styl 文件.这个 .styl 以前没见过啊,你是谁? ...
- Caffe初试
1.基本概念 Caffe是一个比较流行的神经网络框架,它支持C++.Python等语言,容易上手,但是代码貌似不怎么好读,等有空我...;) 2.Windows10下的部署 我把我Windows下的编 ...
- 转:session和cookie以及catch三者的区别
以前实现数据的缓存有很多种方法,有客户端的Cookie,有服务器端的Session和Application. 其中Cookie是保存在客户端的一组数据,主要用来保存用户名等个人信息. Session则 ...
- 【lightoj-1026】Critical Links(桥)
题意: 给出无向图,求桥的模板题. #include <bits/stdc++.h> using namespace std; ; int dfn[N], low[N];//时间戳;low ...
- ARM的37个寄存器
31个通用寄存器,包括程序计数器(PC)在内.这些寄存器都是32位寄存器. 6个状态寄存器.这些寄存器都是32位寄存器. 通用寄存器(R0-R15)可分为三类 :不分组寄存器R0~R7: 分组寄存器R ...