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

思路:用哈希,因为数值大小在[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. JNI_Z_09_Java的字符串

    ZC: jstring 就是 Java中的String对象 ZC: 10.8 Unicode字符串结尾(http://www.360doc.cn/article/14233282_321497569. ...

  2. 回溯和DFS效率分析

    回溯和DFS效率分析 一.心得 多组数据记得初始化 两组样例,找圆点点的个数 6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# . ...

  3. HDU 4531 bfs/康拓展开

    题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4531 吉哥系列故事——乾坤大挪移 Time Limit: 2000/1000 MS (Java/Othe ...

  4. react-quill 富文本编辑器

    适合react的一款轻量级富文本编辑器 1.http://blog.csdn.net/xiaoxiao23333/article/details/62055128 (推荐一款Markdown富文本编辑 ...

  5. Python中的import,from...import以及模块、包、库的概念

    首先,说明一下,我使用的是python3.6.3win32版本,使用的IDE是pycharm2017社区免费版. 刚开始接触python编程不久,有很多概念都不是特别清楚,但是我觉得既然选择,尽自己最 ...

  6. Struts12---文件的下载

    01.创建一个下载的页面  (我们的下载是把文件的路径写成固定的) <body> <form action="user/download" method=&quo ...

  7. LeetCode OJ:Evaluate Reverse Polish Notation(逆波兰表示法的计算器)

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  8. 【python】imp模块的使用

    是import在程序中的使用 [一]函数load_source imp.load_source(moduleName, sourceFile) 使用: abc = imp.load_source('d ...

  9. HTML中的颜色简写

    1.HTML中颜色的五种写法 1)直接用颜色英文名字表示 例如表示背景颜色为白色: 2.通过16进制数表示 例如表示背景颜色为黑色 3).通过RGB方式表示 RGB:是红色(red)绿色(green) ...

  10. 2 秒杀系统模拟基础实现,使用Redis实现

    这一篇,我们来使用redis进行数据存储. 新建一个redis的service实现类 package com.tianyalei.service; import com.tianyalei.model ...