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
#define _CRT_SECURE_NO_WARNINGS
#include <climits>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int num[];
int main()
{
int N;
cin >> N;
vector<int> V(N);
int n = -;
for (int i = ; i < N; i++)
{
cin >> V[i];
num[V[i]]++;
}
for (int i = ; i < N; i++)
{
if (num[V[i]] == )
{
n = i;
break;
}
}
if (n != -)
cout << V[n];
else
cout << "None";
}
1041 Be Unique (20分)(水)的更多相关文章
- 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 分)(简单,一遍过)
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 分)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
- 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) 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)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- 【PAT】1041. Be Unique (20)
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people ...
- 1041. Be Unique (20)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
随机推荐
- c++第一周测验
本次得分为:14.00/14.00, 本次测试的提交时间为:2020-03-08, 如果你认为本次测试成绩不理想,你可以选择再做一次. 1 单选(1分) 下面程序片段哪个没错? 得分/总分 A. in ...
- C++ for循环练习
#include <stdio.h> //题目:现有公鸡5元一只,母鸡3元一只,小鸡1元3只(小鸡不能单买 最少3只起卖),此时顾客有100元,请问有多少种购买方案. int main() ...
- ubuntu下使用apt-get install安装软件的安装位置
在ubuntu下使用 apt-get install 或 apt install 下载安装软件,软件下载及安装后的目录.: A.下载的软件的存放位置:/var/cache/apt/archives B ...
- PBM error occurred during PreCloneCheckCallback: 由于目标计算机积极拒绝,无法连接
问题如下: 迁移存储和主机的时候发生错误,错误如下: 出现了常规系统错误: PBM error occurred during PreCloneCheckCallback: 由于目标计算机积极拒绝,无 ...
- 树链剖分与倍增求LCA
树链剖分与倍增求\(LCA\) 首先我要吐槽机房的辣基供电情况,我之前写了一上午,马上就要完成的时候突然停电,然后\(GG\)成了送链剖分 其次,我没歧视\(tarjan LCA\) 1.倍增求\(L ...
- java-随机点名器(新手)
//创建的一个包名. package qige; //导入一个包.import java.util.Random; //定义一个类.public class Zy1 { //公共静态的主方法. pub ...
- tars之springboot的初步使用
公司要求使用tars框架,现学习的,听老大讲的经验和看的一些技术博客,感觉和SpringCloud有些相似,不过内部有自己的规范,基于rpc实现的服务与服务之间的远程调用,而cloud的远程调用是基于 ...
- XSS构造剖析
参考:邱永华<XSS跨站脚本攻击剖析与防御> 一 绕过XSS-filter 1.利用<>标记注射Html/JavaScript比如:<script>alert('X ...
- MySQL基础知识_2
ta表: tb表: MySQL 查询数据 SELECT 列名,列名 FROM 表名 [WHERE Clause] [LIMIT N][ OFFSET M] 查询语句中可以使用一个或者多个表,表之间使用 ...
- Happens-before先行发生原则
简介 从JDK1.5,java使用新的JSR-133内存模型:JSR-133使用happens-before的概念来阐述操作之间的内存可见性:在JMM中,如果一个操作执行的结果需要对另一个操作可见,那 ...