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>
using namespace std;
int main(){
int T;
cin>>T;
int va[T],coun[];
for(int i=;i<T;i++){
scanf("%d",&va[i]);
coun[va[i]]++;
}
bool has=false;
for(int i=;i<T;i++){
if(coun[va[i]]==) {
cout<<va[i];
has=true;
break;
}
}
if(!has) cout<<"None";
system("pause");
return ;
}

PAT Advanced 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 1041 Be Unique (20) [Hash散列]

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

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

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

  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)

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

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

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

  9. PAT Advanced 1152 Google Recruitment (20 分)

    In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the p ...

随机推荐

  1. perfecto使用

    总配置 application.properties env.resources=src/main/resources/common #配置resource文件所在目录,如.loc定位文件 resou ...

  2. RGB-D显著性突出物体(学习)

    论文阅读:Adaptive Fusion for RGB-D Salient Object Detection 这篇代码的创新点在于使用了SW层,使用SW_logits * img_logits + ...

  3. ControlTemplate in WPF —— Shared in all file

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  4. apache访问日志

    #错误日志ErrorLog "logs/dummy-host2.example.com-error_log" #访问日志CustomLog "logs/dummy-hos ...

  5. Struts+Hibernate+Spring面试题合集及答案

    Struts+Hibernate+Spring面试题合集及答案 Struts+Hibernate+Spring面试题合集 1 1. Hibernate部分 2 1.1. Hibernate工作原理 2 ...

  6. java:Topic About(猴子吃桃,快速排序,选择排序,插入排序)

    1. 猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个 第二天早上又将剩下的桃子吃掉一半,又多吃了一个.以后每天早上都吃了前一天剩下的一半零一个.到第10天早上想再吃时,见只 ...

  7. Spring事务管理配置以及异常处理

    Spring事务管理配置: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  8. 移动手机端通过PC转接实现标签打印的解决方案

    废话不多讲,由于种种原因项目上出现了移动手持录入标签信息通过pc端转接实现打印的需求,所以简单研究了一下,本来考虑使用webapi方式实现,但是发现这种方式调用打印机实现自动打印比较困难,所以转而求其 ...

  9. 跨域常见解决方案jsonp,cors示例

    ​​ 方案   JSONP jsonp需要后端进行配置,并且前端需要动态生成script标签通过callback调用函数进行操作的跨域解决方案 不建议使用该方案: 前后端均需进行配置处理,增加了工作量 ...

  10. Day02:正则表达式 / Object / 包装类

    JAVA正则表达式 实际开发中,经常需要对字符串数据进行一些复杂的匹配,查找,替换等操作. 通过"正则表达式",可以方便的实现字符串的复杂操作. 正则表达式是一串特定字符,组成一个 ...