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]. 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 (≤) 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 <iostream>
#include <unordered_map>
using namespace std;
int N, num[];
int main()
{
cin >> N;
unordered_map<int, int> numbers;
for (int i = ; i < N; ++i)
{
cin >> num[i];
numbers[num[i]]++;//为了保证单得到存数的位子顺序,借助num[i]
}
for (int i = ; i < N; ++i)
{
if (numbers[num[i]] == )
{
cout << num[i] << endl;
return ;
}
}
cout << "None" << endl;
return ;
}

PAT甲级——A1041 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. PAT 甲级 1041 Be Unique

    https://pintia.cn/problem-sets/994805342720868352/problems/994805444361437184 Being unique is so imp ...

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

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

  4. PAT甲级——1041 Be Unique

    1041 Be Unique Being unique is so important to people on Mars that even their lottery is designed in ...

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

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

  6. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  7. PAT甲级题解分类byZlc

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

  8. PAT甲级:1089 Insert or Merge (25分)

    PAT甲级:1089 Insert or Merge (25分) 题干 According to Wikipedia: Insertion sort iterates, consuming one i ...

  9. PAT甲级:1064 Complete Binary Search Tree (30分)

    PAT甲级:1064 Complete Binary Search Tree (30分) 题干 A Binary Search Tree (BST) is recursively defined as ...

随机推荐

  1. MySql查询分页数据

    MySql查询分页数据

  2. namespace 命名空间

    namespace作用:资源隔离 当我们不指定namespace时,默认放在default下 创建namespace kubectl create namespace 资源名称 在生产中,我们建议一个 ...

  3. 机器学习-反向传播算法(BP)代码实现(matlab)

    %% Machine Learning Online Class - Exercise 4 Neural Network Learning % Instructions % ------------ ...

  4. 【颓废篇】人生苦短, 我用python(二)

    当时产生学习python的欲望便是在看dalao们写脚本的时候… 虽然dalao们好像用的是js来着.. 不过现在好像很多爬虫也可以用python写啊… 所以学python没什么不妥. 而且csdn整 ...

  5. jQuery插件编写,

    jQuery插件编写 jQuery插件 最近搞jquery插件的编写这里做下笔记 给jquery扩展的方式很多,看的我眼花缭乱 方式1 $.fun=function(){} 方式2 $.fn.fun= ...

  6. git sync tags with remote

    git 同步遠程標籤 在 .git/config的 [remote "origin"] 下加了 fetch = +refs/tags/*:refs/tags/* 最後就變成 [re ...

  7. token方法可用于临时关闭令牌验证,

    token方法可用于临时关闭令牌验证,例如: $model->token(false)->create(); 即可在提交表单的时候临时关闭令牌验证(即使开启了TOKEN_ON参数). 大理 ...

  8. html选择器[获取兄弟(同级元素)]

    1.html <div class="col-md-5"> <h4 class="m-t-md" id="dwzh"> ...

  9. 基于SpringBoot的开源微信开发平台,Jeewx-Boot 1.0 版本发布

    项目介绍 JeewxBoot 是一款基于SpringBoot的免费微信开发平台.支持微信公众号.小程序官网.微信抽奖活动. Jeewx-Boot实现了微信公众号管理.小程序CMS.微信抽奖活动等基础功 ...

  10. JSON高亮格式化页面显示

    高亮CSS定义: <style type="text/css"> pre {outline: 1px solid #ccc; padding: 5px; margin: ...