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

思路:用哈希,因为数值大小在[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. Spring Boot的核心

    1.1.1.   入口类和@SpringBootApplication Spring Boot的项目一般都会有*Application的入口类,入口类中会有main方法,这是一个标准的Java应用程序 ...

  2. InflateException:Bin file line #19:Error inflating class MyTextView

    InflateException:Bin file line #19:Error inflating class MyTextView 一.错误简介 为了实现TextView的跑马灯效果,我自己写了一 ...

  3. java String转Long两种方法区别

    第一种:包装类型:Byte,Integer,Short,Long,Boolean,Character,Float,Double等8种 Long.valueOf("String")返 ...

  4. 【PAT-L2-020】功夫传人

    链接:https://www.patest.cn/contests/gplt/L2-020 一门武功能否传承久远并被发扬光大,是要看缘分的.一般来说,师傅传授给徒弟的武功总要打个折扣,于是越往后传,弟 ...

  5. LeetCode OJ:Majority Element(主要元素)

    Given an array of size n, find the majority element. The majority element is the element that appear ...

  6. LeetCode OJ:Combination Sum (组合之和)

    Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...

  7. OC-Foundation框架

    ========================== Foundation框架下的常用类 ========================== 一.[NSNumber]================ ...

  8. 内存管理(1)-buddy和slub算法

    Linux内存管理是一个很复杂的系统,也是linux的精髓之一,网络上讲解这方面的文档也很多,我把这段时间学习内存管理方面的知识记录在这里,涉及的代码太多,也没有太多仔细的去看代码,深入解算法,这篇文 ...

  9. VMware Workstation/Fusion 14/15 密钥

    VMware WorkStation 14 CG54H-D8D0H-H8DHY-C6X7X-N2KG6 ZC3WK-AFXEK-488JP-A7MQX-XL8YF AC5XK-0ZD4H-088HP- ...

  10. socketserver模块简介

    1. socketserver模块简介 在python的socket编程中,实用socket模块的时候,是不能实现多个连接的,当然如果加入其 它的模块是可以的,例如select模块,在这里见到的介绍下 ...