题意:找到一串数字序列中首个出现的不重复的数字。

思路:用哈希,因为数值大小在[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的更多相关文章

  1. PAT 甲级 1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  2. 1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  3. 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 ...

  4. PAT 1041 Be Unique[简单]

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  5. pat 1041 Be Unique(20 分)

    1041 Be Unique(20 分) Being unique is so important to people on Mars that even their lottery is desig ...

  6. PAT 甲级 1041 Be Unique (20 分)(简单,一遍过)

    1041 Be Unique (20 分)   Being unique is so important to people on Mars that even their lottery is de ...

  7. PAT甲级——1041 Be Unique

    1041 Be Unique Being unique is so important to people on Mars that even their lottery is designed in ...

  8. 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 ...

  9. 【PAT】1041. Be Unique (20)

    题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...

  10. 1041. Be Unique (20)

    Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...

随机推荐

  1. python之list,tuple,str,dic简单记录(二)

    切片对象:例子:In [13]: l = [1,23,4,5,5,6,8]In [14]: l[::1]Out[14]: [1, 23, 4, 5, 5, 6, 8] In [15]: l[::2]O ...

  2. Eclipse工具栏上android的机器人小图标不见了

    可以通过「Window」⇒「Customize Perspective」⇒「Tool Bar Visibility」Tab画面上选择Android SDK and AVD Manager来显示

  3. 临时开启Chrome 67拖放crx安装扩展方法

    打开Chrome的设置: chrome://flags/#extensions-on-chrome-urls 更改为enabled,应用后重起浏览器,就可以往 chrome://extensions ...

  4. day5-hashlib模块

    一.概述 在程序开发过程中,很多时候会涉及用户信息验证环节,这类场景下我们往往需要对字符串进行加密处理.python中也有专门的加密模块,它就是hashlib.下面章节将详述它的常见用法. 二.常见加 ...

  5. .SourceInsight添加.S文件

    在Option->Document Option添加配置.S然后再去添加文件

  6. MySQL密码过期

    1.用mysql命令行登录mysql的root用户 2.重新修改root密码 SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); my ...

  7. js控制iframe的刷新(页面局部刷新)

    今天遇到个问题,后台会员审核之后,页面内的会员审核状态要及时改变,但又不能指望用户手动刷新(用户体验很不好) 如果审核页面和显示审核状态时同在一个html页面的话,那么直接用js改变div内部的文本就 ...

  8. [置顶] Android RadioButton与TextView浪漫约会?

    情景一 今天主要实现一个国家与地区切换,就是当我们选中RadioButton时然后将值设置到TextView中,听着这需求应该不难对吧?那么我们就开始约会吧? 看下原型图 准备条件: 首先需要一个ra ...

  9. Android OpenCSV

    OpenCSV https://sourceforge.net/projects/opencsv/ 使用参考 http://stackoverflow.com/questions/16672074/i ...

  10. Delphi Xe4 游戏开发的技术选型.

    asphyre 是支持 FireMonkey的. 利用Firemonkey的跨平台接口.实现 win,mac,ios. 其它方案估计就得靠 FPC 了. 好处是多了输出Andriod的可能. zeng ...