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 ...
随机推荐
- 非均匀B样条离散点的加密与平滑
非均匀B样条离散点的加密与平滑 离散点的预处理是点云网格化很关键的一步,主要就是离散点的平滑.孔洞修补:本文是基于非均匀B样条基函数进行离散点云的加密和平滑的,一下为初步实现结果. 算法步骤: 1.数 ...
- Shell实现交互式登陆一台同时管理多台机器
最近为了检测公司服务器的硬盘需要开10多台服务器的僚机来检测服务器,可是这10来台都是操作一样的命令,挨个操作下去太麻烦了 然后就想到了交互式登陆 这里需要创建一个Ip文件夹把你的Ip账户密码都放进去 ...
- python出现AttributeError: module ‘xxx’ has no attribute ‘xxx’错误时,两个解决办法
运行python程序时,也许会出现这样的错误:AttributeError: module ‘xxx’ has no attribute ‘xxx’: 解决该错误有两种方法 1.手动安装该模块 2.检 ...
- dubbo的启动方法
Dubbo服务的运行方式: 1.使用Servlet容器运行(Tomcat.Jetty等)----不可取 缺点:增加复杂性(端口.管理) 浪费资源(内存)2.自建Main方法类来运行(spring容器) ...
- [转] 浅谈JS中的变量及作用域
Situation One <script> var i; function sayHello() { var x=100; alert(x); x++; } sayHello(); ...
- mybatis整合spring,使用org.mybatis.spring.mapper.MapperScannerConfigurer扫描出现问题
<!-- 加载配置文件 --> <context:property-placeholder location="classpath:db.properties" ...
- js处理表情字符且让数据库支持emoji表情符存储
数据库处理 更换字符集utf8-->utf8mb4 JS处理 将表情转为字符: function utf16toEntities(str) { var patt=/[\ud800-\udbff] ...
- python 包的概念
包的概念 包的概念: 在python中包即使模块,是一系列功能的集合体, 为什么要用包? 提高开发效率 如何用包 import ... from ... import ..... 如何认识它就是一包 ...
- Hbase 三维存储
hbase所谓的三维有序存储的三维是指:rowkey(行主键),column key(columnFamily+qualifier),timestamp(时间戳)三部分组成的三维有序存储. 1.row ...
- python生成饼图解决中文乱码
解决乱码问题 乱码的原因 字体的不匹配 解决的方法 加上引用中文字体就好了 matplotlib.rcParams['font.sans-serif'] = ['SimHei'] 代码 def sta ...