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. 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 分)的更多相关文章
- PAT 甲级 1041 Be Unique (20 分)(简单,一遍过)
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is de ...
- 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 ...
- 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 ...
- 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 ...
- PAT 1041 Be Unique (20分)利用数组找出只出现一次的数字
题目 Being unique is so important to people on Mars that even their lottery is designed in a unique wa ...
- 【PAT甲级】1041 Be Unique (20 分)(多重集)
题意: 输入一个正整数N(<=1e5),接下来输入N个正整数.输出第一个独特的数(N个数中没有第二个和他相等的),如果没有这样的数就输出"None". AAAAAccepte ...
- 【PAT】1041. Be Unique (20)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...
- PAT 甲级 1041. Be Unique (20) 【STL】
题目链接 https://www.patest.cn/contests/pat-a-practise/1041 思路 可以用 map 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 ...
- 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 ...
随机推荐
- php设计模式-注册树模式
php注册树模式 1.什么是注册树模式? 注册树模式通过将对象实例注册到全局对象树上,需要的时候将对象从全局对象树上取下来,就像小时候买糖葫芦一样,卖糖葫芦的将糖葫芦插在一个大的杆子上,人们买的时候就 ...
- 【转】HTML怎样使用a标签以post方式提交
在HTML中,a标签的提交默认是get方式提交的,如果在请求链接的参数中带有中文就会出现乱码问题,除了在后台程序中转码外,这里介绍两种简单的方法,可以在客户端让a标签以post方式提交. 一:增加一个 ...
- SweetAlert(弹出层插件)
怀着非常.非常恼火的心情写下这个博文.我深深怀疑有一些人只会瞎粘贴复制别人的博文,自己试都不试就发布到网上,左右看的人想法,就此深通恶绝!! 废话不多说. SweetAlert是一个简洁好用的自制Al ...
- JavaScript中二进制与10进制互相转换
webpack打包生成的代码中涉及了一些二进制位与的操作, 所以今天来学习一下JavaScript中的二进制与十进制转换操作吧 十进制转二进制: var num = 100 num.toString( ...
- 阶段3 2.Spring_01.Spring框架简介_04.spring发展历程
- 63不同路径II
题目: 一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” ).机器人每次只能向下或者向右移动一步.机器人试图达到网格的右下角(在下图中标记为“Finish”).现在考 ...
- FPGA VGA时序的理解
最近在做FPGA毕业设计,毕业设计规划的是摄像头采集图像,经过均值滤波,中值滤波,高斯滤波,然后通过VGA接口控制显示器显示出来,所以最近学习了一下FPGA的VGA驱动的相关内容. VGA接口 如上图 ...
- [IJCAI-17 口碑商家客流量预测]
IJCAI-17 口碑商家客流量预测 第 1 赛季截止日期 2017/03/14 赛制介绍 重要时间2月8日 08:00: 评测启动3月7日 10:00: 报 ...
- HDU2196 Computer【换根dp】
题目传送门 题意: 给定一个$N$个点的树,第$i$条边的长度是$A_i$,求每个点到其他所有点的最长距离.数据范围:$n ≤ 10000$,$A_i ≤ 10_9$ 分析 首先,从随便哪个节点($1 ...
- 【Qt开发】布局控件之间的间距设置
void QLayout::setContentsMargins ( int left, int top, int right, int bottom ) Sets the left, top, ri ...