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

思路:用哈希,因为数值大小在[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. 使用SpringMVC时报错HTTP Status 405 - Request method 'GET' not supported

    GET方法不支持.我出错的原因在于,在JSP中我希望超链接a以post方式提交,但是这里写js代码时出错. <script type="text/javascript"> ...

  2. PHP使用前的了解

    PHP简介 PHP 是什么? PHP(全称:PHP:Hypertext Preprocessor,即"PHP:超文本预处理器")是一种通用开源脚本语言. PHP 脚本在服务器上执行 ...

  3. 不能在Python Console中运行pytest

    在Python Console中运行pytest发现报错了 这是为什么?因为Python Console已经是进入python之后的环境,就像在python自带的IDLE中运行pytest pytes ...

  4. 21-THREE.JS 将法线矢量映射到RGB颜色的材质

    <!DOCTYPE html> <html> <head> <title></title> <script src="htt ...

  5. 解决通用串行总线(USB)控制器有感叹号

    (转自:http://blog.sina.com.cn/s/blog_44190ce10101ejth.html)   通用串行总线控制器:由于其配置信息(注册表中的)不完整或已损坏,Windows ...

  6. HDU 1561 The more, The Better(树形DP+01背包)

    The more, The Better Time Limit : 6000/2000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other ...

  7. Linux命令四

    作业一: 1) 开启Linux系统前添加一块大小为20G的SCSI硬盘 2) 开启系统,右击桌面,打开终端 安装的是命令行界面 3) 为新加的硬盘分区,一个主分区大小为10G,剩余空间给扩展分区,在扩 ...

  8. 【爬虫】beautiful soup笔记(待填坑)

    Beautiful Soup是一个第三方的网页解析的模块.其遵循的接口为Document Tree,将网页解析成为一个树形结构. 其使用步骤如下: 1.创建对象:根据网页的文档字符串 2.搜索节点:名 ...

  9. DRF 返回数据的封装,和分页

    DRF 返回数据的封装,和分页 1 返回值的 封装 自定义一个类,初始化基本的返回数据信息 class BaseResponse(object): """ 初始化基本的返 ...

  10. [置顶] 【机器学习PAI实践四】如何实现金融风控

    (本文数据为虚构,仅供实验) 一.背景 本文将针对阿里云平台上图算法模块来进行实验.图算法一般被用来解决关系网状的业务场景.与常规的结构化数据不同,图算法需要把数据整理成首尾相连的关系图谱.图算法更多 ...