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:

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 <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#define LL long long
using namespace std;
const int MAX = 1e5 + ; map <int, int> mp;
map <int, int> :: iterator iter;
int n, a, A[MAX]; int main()
{
// freopen("Date1.txt", "r", stdin);
scanf("%d", &n);
for (int i = ; i < n; ++ i)
{
scanf("%d", &a);
A[i] = a;
mp[a] ++;
} for (int i = ; i < n; ++ i)
{
if (mp[A[i]] == )
{
printf("%d\n", A[i]);
return ;
}
}
printf("None\n");
return ;
}

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

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

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

  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 甲级 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 Advanced 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 分)(多重集)

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

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

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

  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[简单]

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

  9. pat 1035 Password(20 分)

    1035 Password(20 分) To prepare for PAT, the judge sometimes has to generate random passwords for the ...

随机推荐

  1. [USACO10NOV]奶牛的图片Cow Photographs

    题目描述 Farmer John希望给他的N(1<=N<=100,000)只奶牛拍照片,这样他就可以向他的朋友炫耀他的奶牛. 这N只奶牛被标号为1..N. 在照相的那一天,奶牛们排成了一排 ...

  2. libevent::bufferevent

    #include <cstdio> #include <netinet/in.h> #include <sys/socket.h> #include <fcn ...

  3. 共轭梯度法求解协同过滤中的 ALS

    协同过滤是一类基于用户行为数据的推荐方法,主要是利用已有用户群体过去的行为或意见来预测当前用户的偏好,进而为其产生推荐.能用于协同过滤的算法很多,大致可分为:基于最近邻推荐和基于模型的推荐.其中基于最 ...

  4. 后缀数组(SA)

    学习了LRJ神犇的代码.orz. 首先真心建议了解下基数排序!!且要有一定的c++程序经验,否则程序很难看懂. 然后对着下面的程序调试(假装你已经会了算法思想) 弄个一个礼拜一下午就能学会了. 该算法 ...

  5. 百万年薪python之路 -- 迭代器

    3.1 可迭代对象 3.1.1 可迭代对象定义 **在python中,但凡内部含有 _ _ iter_ _方法的对象,都是可迭代对象**. 3.1.2 查看对象内部方法 该对象内部含有什么方法除了看源 ...

  6. MacOs mysql 安装

    1. 去官网下载mysql镜像:https://dev.mysql.com/downloads/file/?id=475582 2.  双击镜像文件 - >  双击.pkg文件 -> 出现 ...

  7. Codeblocks 等软件 修改源代码后 不能立即执行的解决办法||exe文件删除慢

    不懈地奋斗了两天,终于找到原因了. 记录如下 症状: Codeblocks .Visual Studio 都出现此问题:修改源代码 无法立即执行 ,就是:cannot open output file ...

  8. MySQL基础篇(2)数据类型

    MySQL提供了多种数据类型,主要包括数值型.字符串类型.日期和时间类型. 1.数值类型 整数类型:TINYINT(1字节).SMALLINT(2字节).MEDIUMINT(3字节).INT(INTE ...

  9. 如何在python文件中测试sql语句

    在manage.py的同级目录下新建一个run.py import os if __name__ == '__main__': #加载Django项目的配置信息 os.environ.setdefau ...

  10. rem辅助式响应布局

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...