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 ...
随机推荐
- flutter textfield
释放光标 FocusScope.of(context).unfocus() 输入类型 keyboardType: TextInputType.number, 键盘右下角按键类型 textInputAc ...
- ControlTemplate in WPF —— ListBox
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...
- Oracle 笔记(三)
Oracle的数据库对象 七大对象:用户.表.约束.序列.视图.同义词和索引 知识点一:用户 - User - 账户.管理员-一切对象的宿主 1.创建用户 ???? 2.授权 ???? 授权+ ...
- C++ 简介 基本语法 注释
一.第一个 C++ 程序 #include <iostream> using namespace std; int main() { cout << "Hello, ...
- Altera DDR2 IP核学习总结3-----------DDR2 IP核的使用
根据上一篇生成的IP核,例化之后如上图,Local开头的数据是用户侧数据,其他数据暂时不用纠结,不用管. 这些是需要关注的信号,但是初学阶段很难对这些信号形成具体的概念,这里参考明德扬的代码进行二次封 ...
- 换根dp特征总结
Rt,大概总结一下吧(不时更新一小下 1.一般都没有指定根,刚开始随便选一个根(1号点工具人) 2.两次$dfs$,一次从工具人开始预处理一些东西,第二次(也是从工具人开始)换根. 3.多用于:只要确 ...
- 【OpenCV开发】OpenCV:使用VideoCapture类进行视频读取和显示
原文来自:http://blog.csdn.net/thefutureisour/article/details/7530344 -------------以下为原文---------------这次 ...
- 简述Vue中使用Vuex
1.为什么要用vuex 在vue组件通信的过程中,我们通信的目的往往就是在组件之间传递数据或组件的状态(这里将数据和状态统称为状态),进而更改状态.但可以看到如果我们通过最基本的方式来进行通信,一旦需 ...
- python 爬取百度url
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2017-08-29 18:38:23 # @Author : EnderZhou (z ...
- mavn Nexus Repository Manager漏洞
https://www.secpulse.com/archives/112290.html