问题 C: 6112 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, 104]. 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.
输入
Each input file contains one test case. Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets. The numbers are separated by a space.
输出
For each test case, print the winning number in a line. If there is no winner, print “None” instead.
样例输入
7 5 31 5 88 67 88 17
5 888 666 666 888 888
样例输出
31
None

#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 100000;
int main() {int N;while(cin>>N) {int nums[N], count[maxn] = {0};for (int i = 0; i < N; i++) {cin>>nums[i];count[nums[i]]++;}int find = 0;for (int i = 0; i < N; i++) {if (count[nums[i]] == 1) {cout<<nums[i]<<endl;find = 1;break;}}if (!find) cout<<"None"<<endl;}return 0;
}

C/C++[codeup 6112]Be Unique相关推荐

  1. codeup墓地目录(算法笔记习题刷题笔记)

    在线codeup contest 地址:http://codeup.cn/contest.php Contest100000575 - <算法笔记>3.1小节--入门模拟->简单模拟 ...

  2. codeup墓地目录

    代码内容为原创C++ 在线codeup contest 地址:http://codeup.cn/contest.php Contest100000575 - <算法笔记>3.1小节--入门 ...

  3. 算法笔记CodeUp第一至第六章刷题记录

    文章目录 <算法笔记>2.2小节--C/C++快速入门->顺序结构 1.例题1-1-1 按要求输出信息(1) 2.例题1-1-2 按要求输出信息(2) 3.例题1-2-1 求两个整数 ...

  4. key mysql_mysql中key 、primary key 、unique key 与index区别

    mysql中索引是非常重要的知识点,相比其他的知识点,索引更难掌握,并且mysql中的索引种类也有很多,比如primary key .unique key 与index等等,本文章向大家介绍mysql ...

  5. Lumion模型库 Unique Pro Lumion Library 2021

    Lumion模型库 Unique Pro Lumion Library 2021 独特的专业图书馆2021 大小:12G  云桥网络 平台获取素材 这些包包括: 01–集总效果–准备渲染的外部设置 用 ...

  6. mysql单列索引和多列索引_mysql索引类型 normal, unique, full text

    问题1:mysql索引类型normal,unique,full text的区别是什么? normal:表示普通索引 unique:表示唯一的,不允许重复的索引,如果该字段信息保证不会重复例如身份证号用 ...

  7. 1041 Be Unique

    1.依旧是散列题,开一个整形的哈希数组bets[10010]来计数,最后数目为1的,也就是unique 2.注意,可能为1的不止一个,要输出第一个输入的unique,那么需要记录下读入的顺序,可以开辟 ...

  8. Using unique option prefix myisam-recover instead of myisam-recover-option

    [转载]关于mysql error.log报"Using unique option prefix myisam-recover instead of myisam-recover-opti ...

  9. 2019年2月26日 Unique Email Addresses、To Lower Case、Encode and Decode TinyURL

    今天开始加快速度,趁着还有空多刷几题,语言换成python提高速度了. 1. Unique Email Addresses 弱题,注意@符号前后的处理方式不同 class Solution(objec ...

  10. C++STL中的unique函数解析

    一.总述 unique函数属于STL中比较常用函数,它的功能是元素去重.即"删除"序列中所有相邻的重复元素(只保留一个).此处的删除,并不是真的删除,而是指重复元素的位置被不重复的 ...

最新文章

  1. PostgreSQL将表导出为CSV(服务器端、客户机端)完整版
  2. 基于Android的ELF PLT/GOT符号重定向过程及ELF Hook实现
  3. Federated learning论文修改2021-11-14(X-Y Liang)
  4. des加密出的字符串有特殊字符吗_纯干货分享丨内网渗透很难学吗?
  5. Python入门(01) -- 列表简介
  6. ensp中小型企业网配置_如何构建1000人规模的网络,详细配置?
  7. Android基础新手教程——3.4 TouchListener PK OnTouchEvent + 多点触碰
  8. 数据线为什么不弄两头都是Typec接口的呢?
  9. CodeForces Round #191 (327C) - Magic Five 等比数列求和的快速幂取模
  10. java 枚举不能继承_Java中的枚举类为何不能有public构造器
  11. [经验]修改SDI主窗口Title
  12. xp系统共享文件夹免密码访问设置
  13. IC Compiler指南——布图规划(一)
  14. 写个鸭子类方法java_小黄鸭系列java基础知识 | Java基本语法
  15. linux 运行QQ /Tim(超简单)
  16. js-xlsx插件导出的excel头部有一行序号解决办法
  17. maven中实现代码单元测试覆盖率统计
  18. 一、C++面向对象高级编程(上) (侯捷)
  19. 什么是自动化测试框架?这就是自动化测试框架。
  20. [Ajax]ajax入门

热门文章

  1. Springboot: 修改启动时默认图案
  2. C#可空类型(Nullable)
  3. linux git clone 401,Git Eclipse:401未经授权的错误
  4. android桌面快捷网页,Android向桌面添加快捷方式,使其指向特定的网页
  5. java中装饰器_java设计模式之装饰器模式以及在java中作用
  6. 5分钟了解分页的那些事?
  7. Linux 配置mail发送邮件
  8. MYSQL——数据修改
  9. python不同目录下的调用
  10. VMWaer克隆centos后网络的问题解决