Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on a unique number wins. For example, if there are 7 people betting on 5 31 5 88 67 88 17, then the second one who bets on 31 wins.

Input Specification:

Each input file contains one test case. Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets. The numbers are separated by a space.

Output Specification:

For each test case, print the winning number in a line. If there is no winner, print "None" instead.

Sample Input 1:

7 5 31 5 88 67 88 17

Sample Output 1:

31

Sample Input 2:

5 888 666 666 888 888

Sample Output 2:

None
 #include<cstdio>
#include<iostream>
using namespace std;
int hashTB[] = {,}, record[];
int main(){
int N, find = -;
scanf("%d", &N);
for(int i = ; i < N; i++){
scanf("%d", &record[i]);
hashTB[record[i]]++;
}
for(int i = ; i < N; i++){
if(hashTB[record[i]] == ){
find = i;
break;
}
}
if(find == -)
printf("None");
else printf("%d", record[find]);
cin >> N;
return ;
}

总结:

1、本题题意:按照输入的顺序,找出第一个只出现一次的数字并输出。

A1041. Be Unique的更多相关文章

  1. PAT甲级——A1041 Be Unique

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

  2. A1041 Be Unique (20 分)

    一.技术总结 这题在思考的时候遇见了,不知道怎么处理输入顺序问题,虽然有记录每个的次数,事后再反过来需要出现一次的且在第一次出现, 这时我们其实可以使用另一个数组用来存储输入顺序的字符,然后再用另一个 ...

  3. PAT_A1041#Be Unique

    Source: PAT A1041 Be Unique (20 分) Description: Being unique is so important to people on Mars that ...

  4. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

  5. 1041 Be Unique (20 分)

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

  6. [LeetCode] Unique Substrings in Wraparound String 封装字符串中的独特子字符串

    Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz" ...

  7. [LeetCode] Minimum Unique Word Abbreviation 最短的独一无二的单词缩写

    A string such as "word" contains the following abbreviations: ["word", "1or ...

  8. [LeetCode] Count Numbers with Unique Digits 计算各位不相同的数字个数

    Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...

  9. [LeetCode] Unique Word Abbreviation 独特的单词缩写

    An abbreviation of a word follows the form <first letter><number><last letter>. Be ...

随机推荐

  1. 一台服务器多实例mysql做主从复制

    在一台服务器上开两个端口的mysql(3306.3307),做成主从复制环境 1)安装mysql(安装过程这里就不做过多介绍) 参考:http://www.cnblogs.com/kevingrace ...

  2. ELK实时日志分析平台环境部署--完整记录

    在日常运维工作中,对于系统和业务日志的处理尤为重要.今天,在这里分享一下自己部署的ELK(+Redis)-开源实时日志分析平台的记录过程(仅依据本人的实际操作为例说明,如有误述,敬请指出)~ ==== ...

  3. 网易云课堂-----Linux内核分析-----期末主观题

    姚歌 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 下面是对8个课题的 ...

  4. 结对项目https://github.com/bxoing1994/test/blob/master/源代码

    所选项目名称:文本替换      结对人:曲承玉 github地址 :https://github.com/bxoing1994/test/blob/master/源代码 结对人github地址:ht ...

  5. Alpha 答辩总结模板

    Alpha 答辩总结模板 每个小组提供一篇总结博客(组内共享,每个人都发布),包含: 本组(组名)所有成员(短学号,名,标注组长)(1分) 组内各成员贡献比例,如不提供,取平均分后组长得分减50% G ...

  6. my项目的总结2015.8.26编

    这已经是上上个星期的事了,现在回顾一下: 负责的模块是"my",更精准的说应该是my里面的个人信息管理 由于项目分域,模块已经分好了,涉及到的只是在现有的基础上解决分域后遗留的历史 ...

  7. pom.xml mevan 的 配置文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. HDU 2043 密码

    http://acm.hdu.edu.cn/showproblem.php?pid=2043 Problem Description 网上流传一句话:"常在网上飘啊,哪能不挨刀啊-" ...

  9. [cnblog新闻]阿里的营业利润3倍于亚马逊,但为何市值只是亚马逊的一半?

    阿里的营业利润3倍于亚马逊,但为何市值只是亚马逊的一半? 投递人 itwriter 发布于 2019-01-26 16:52 评论(0) 有688人阅读 原文链接 [收藏] « » http://ww ...

  10. Windows查看端口被什么进程占用的简单方法----菜鸟养成

    1.  还是因为同事告知Oracle的服务器连不上 最后发现改了端口就可以了, 但是很困惑 不知道为什么会这样,然后简单查了下: 命令 netstat -ano 查看监听的端口 baidu出来一个管道 ...