1041 Be Unique (20 分)

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,10​4​​]. 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 (≤10​5​​) 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:

  1. 7 5 31 5 88 67 88 17

Sample Output 1:

  1. 31

Sample Input 2:

  1. 5 888 666 666 888 888

Sample Output 2:

  1. None
  2. 分析:散列,水题
  1. /**
  2. * Copyright(c)
  3. * All rights reserved.
  4. * Author : Mered1th
  5. * Date : 2019-02-25-20.44.45
  6. * Description : A1041
  7. */
  8. #include<cstdio>
  9. #include<cstring>
  10. #include<iostream>
  11. #include<cmath>
  12. #include<algorithm>
  13. #include<string>
  14. #include<unordered_set>
  15. #include<map>
  16. #include<vector>
  17. #include<set>
  18. using namespace std;
  19. ;
  20. };
  21. };
  22. int main(){
  23. #ifdef ONLINE_JUDGE
  24. #else
  25. freopen("1.txt", "r", stdin);
  26. #endif
  27. int n;
  28. cin>>n;
  29. ;i<n;i++){
  30. scanf("%d",&a[i]);
  31. hashtable[a[i]]++;
  32. }
  33. int i;
  34. ;i<n;i++){
  35. ){
  36. printf("%d",a[i]);
  37. ;
  38. }
  39. }
  40. if(i==n) printf("None");
  41.  
  42. ;
  43. }

1041 Be Unique (20 分)的更多相关文章

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

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

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

  3. PAT Advanced 1041 Be Unique (20 分)

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

  4. 1041 Be Unique (20分)(水)

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

  5. PAT 1041 Be Unique (20分)利用数组找出只出现一次的数字

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

  6. 【PAT甲级】1041 Be Unique (20 分)(多重集)

    题意: 输入一个正整数N(<=1e5),接下来输入N个正整数.输出第一个独特的数(N个数中没有第二个和他相等的),如果没有这样的数就输出"None". AAAAAccepte ...

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

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

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

  9. 1041. Be Unique (20)

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

  10. PAT 甲级 1041. Be Unique (20) 【STL】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1041 思路 可以用 map 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 ...

随机推荐

  1. <NET CLR via c# 第4版>笔记 第12章 泛型

    泛型优势: 源代码保护 使用泛型算法的开发人员不需要访问算法的源代码.(使用c++模板的泛型技术,算法的源代码必须提供给使用算法的用户) 类型安全 向List<DateTime>实例添加一 ...

  2. 卡巴斯基KAV2013 – 免费一年 (六一活动)

    赠送时间:2013年5月31日10时 至 2013年6月1日24时赠送产品:卡巴斯基反病毒软件2013(一年版)赠送方式:产品激活码将以电邮方式发送到您提交信息的邮箱里,每个邮箱仅能领取一个激活码.温 ...

  3. Individual work 总结

    不得不说,这是我上大学以来所花时间最长.收获最多的个人项目之一.在此之前,虽然也上过面向对象等课程,课程对编程代码量的要求并不比这个小,但是由于从没有如这次这般,完全靠自己学习新的编程语言并进行编程实 ...

  4. 《Effective Java 第二版》读书笔记

    想成为更优秀,更高效程序员,请阅读此书.总计78个条目,每个对应一个规则. 第二章 创建和销毁对象 一,考虑用静态工厂方法代替构造器 二, 遇到多个构造器参数时要考虑用builder模式 /** * ...

  5. iframe 问题集合

    1. 历史记录问题 Firefox: 如果iframe是静态存在在HTML中时,iframe的任何src或者location改变都会被记录到浏览器history中. 如果iframe是在页面加载完成后 ...

  6. postman--安装及Interceptor插件

        1. 官网安装(看网速-我下载的时候一直下载失败) 打开官网,https://www.getpostman.com 选择ios或者win 2. 非官网安装 https://pan.baidu. ...

  7. UI基础:UIView(window,frame,UIColor,CGPoint,alpha,CGRect等) 分类: iOS学习-UI 2015-06-30 20:01 119人阅读 评论(0) 收藏

    UIView 视图类,视图都是UIView或者UIView子类 UIWindow 窗口类,用于展示视图,视图一定要添加window才能显示 注意:一般来说,一个应用只有一个window 创建一个UIW ...

  8. Vue拖拽组件

    vue开发公众号项目,***产品需要添加一个新的功能.拖拽功能.一听简单.百度上轮子挺多,直接拉一个过来用着就行.然鹅...兴奋之余,却失望至极.东西很多,没有一个能使得.你让我失望,那我就让你绝望. ...

  9. mysql-python安装时mysql_config not found

    在安装 mysql-python时,会出现: sh: mysql_config: not found Traceback (most recent call last):   File "s ...

  10. Try .NET

    微软新出的好东西——Try .NET,该平台可以让开发者直接在线上编写并运行 .NET 代码. 没啥好说的进去就完事了 平台链接:https://try.dot.net/?fromGist=df448 ...