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 ...
随机推荐
- leetcode-easy-trees-108. Convert Sorted Array to Binary Search Tree
mycode 81.75 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x) ...
- Python2.x与Python3.x的主要区别(转)
python2.x和python3.x版本有很大的差异,除了依赖包的名称变化很大外,其主要差异总结如下: 1)print函数 Python3中,print函数的括号是必须的,Python2是可选的. ...
- Nginx负载均衡服务器实现会话粘贴的几种方式
1. 使用Nginx 的ip_hash作为负载均衡服务并支持Session sticky 2. 使用nginx sticky第三方模块实现基于cookie的负载均衡 3.使用nginx的map指令根据 ...
- svn版本合并
假如你的项目(这里指的是手机客户端项目)的某个版本(例如1.0版本)已经完成开发.测试并已经上线了,接下来接到新的需求,新需求的开发需要修改多个文件中的代码,当需求已经开始开发一段时间的时候,突然接到 ...
- Stream parallel并行流的思考
1.并行流并不一定能提高效率,就和多线程并不能提高线程的效率一样 因为引入并行流会引起额外的开销,就像线程的频繁上下文切换会导致额外的性能开销一样,当数据在多个cpu中的处理时间小于内核之间的传输时间 ...
- 报错:java.lang.NoClassDefFoundError: com/google/inject/Injector
使用testng report,导入jar包:reportng.jar和velocity-dep-1.4.jar后,执行脚本,报错如下: 缺少依赖的jar包:guice-4.0.jar 导入依赖的ja ...
- 【HANA系列】【第八篇】SAP HANA XS使用Data Services查询CDS实体【二】
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列][第八篇]SAP HANA XS ...
- 用linux主机做网关搞源地址转换(snat)
一.原理图 二.环境 外网 A:192.168.100.20 (vmnet1) 网关 B:192.168.100.10 (vmnet1) 192.168.200.10 (vmnet2) ...
- Nginx日志监控工具
ngxtop是一个基于python的程序,可以在Python上安装.ngxtop通过实时解析nginx访问日志, 并将结果(nginx服务器的有用指标)输出到终端. 主要的功能 当前有效请求 总请求计 ...
- ps和top进程监控
一.名词解释 1.什么是进程(what is process)? 答:进程是程序运行的过程,伴有动态,生命和运行状态.(组成:1.已分配内存的地址空间 2.安全属性,包括所有权凭据和特权 3.程序 ...