A1041 Be Unique (20)
Powered by:NEFU AB-IN
Link
文章目录
- A1041 Be Unique (20)
- 题意
- 思路
- 代码
A1041 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,10^4]. 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.
思路
模拟即可
代码
/* * @Author: NEFU AB-IN * @Date: 2023-01-09 19:15:51 * @FilePath: \GPLT\A1041\A1041.cpp * @LastEditTime: 2023-01-09 19:18:16 */ #include <bits/stdc++.h> using namespace std; #define int long long #undef int#define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define IOS \ios::sync_with_stdio(false); \cin.tie(nullptr); \cout.tie(nullptr) #define DEBUG(X) cout << #X << ": " << X << '\n' typedef pair<int, int> PII;const int N = 1e5 + 10, INF = 0x3f3f3f3f;signed main() {IOS;int n;unordered_map<int, int> mp;cin >> n;vector<int> a(n);for (int i = 0; i < n; ++i)cin >> a[i], mp[a[i]]++;for (auto &num : a){if (mp[num] == 1){cout << num;return 0;}}cout << "None";return 0; }
A1041 Be Unique (20)相关推荐
- 【PAT (Advanced Level) Practice】1041 Be Unique (20 分)
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...
- PAT甲级 -- 1041 Be Unique (20 分)
Being unique is so important to people on Mars that even their lottery is designed in a unique way. ...
- 【题意+解析】1041 Be Unique (20 分)_18行代码AC
立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 Being unique is so important to people on Mars that even their lo ...
- 问题 C: Be Unique (20)--《算法笔记》
题目描述 Being unique is so important to people on Mars that even their lottery is designed in a unique ...
- 【PAT甲级 LinkedHashMap】1041 Be Unique (20 分) Java、C++版
题目 题目的意思是,找到第一个不重复的元素.输出它. 一开始用Java做,试了好多种方法都超时.后来换用C++通过了. AC题解:C++版 用Java尝试了各种方式,都是后两个测试点过不去,只好换C+ ...
- 【PAT甲级】A1001-A1050刷题记录
文章目录 A1001 A+B Format (20 分) 0.25 ★(一元多项式加法) A1002 A+B for Polynomials (25 分) 0.21 (单源最短路Dijkstra+边权 ...
- PAT甲级题目翻译+答案 AcWing(模拟)
1008 Elevator (20 分) 思路 :last可能等于cur,而无论是否相等,res都是+5的 #include <iostream>using namespace std;i ...
- 【最新合集】PAT甲级最优题解(题解+解析+代码)
以下每道题均是笔者多方对比后, 思考整理得到的最优代码,欢迎交流! 共同成长哇.可以和博主比拼一下谁刷的更快~ 欢迎收藏.欢迎来玩儿 PAT题解目录 题号 标题 题解 分类 使用算法 1001 A+B ...
- JavaScript使用hash表方式实现数组去重。
function unique(arr){var hash = [], result = [],item;hash[arr[0]]=1;for (var i=1;i<arr.length ;i+ ...
最新文章
- 分布式存储Ceph 快速安装手册
- vue手机端回退_推荐3个快速开发平台 前后端都有 接私活又有着落了
- SVM+HOG:从完全不包含人体的图片中随机剪裁出64*128大小的用于人体检测的负样本
- Linux 关闭网络管理服务
- 软件可用性测试mantis,可用性测试(软件/Web)
- 2017.10.9 放棋子 思考记录
- MongoDB可视化工具Robomongo 和 Mongochef
- IPTV 行业机顶盒EPG关键点
- CNC数控加工中心编程好学吗
- python绘制散点图和折线图_Python散点图与折线图绘制过程解析
- axio的请求异常响应统一处理
- 《重装系统》Windows纯净装机+常用工具(最简单易懂教程)--菜鸟小回
- 计算机复制方法有,电脑复制粘贴怎么用(6种电脑复制粘贴方法)
- 【学习笔记】数字图像基础02
- 运用瀑布模型完成PL/SQL程序设计
- chiinv函数java_Excel 使用CHIINV函数和GAMMA.DIST函数绘制卡方分布
- channel的使用总结
- windows完全卸载office
- 基于C#的AE二次开发导出地图为JPG、TIF、PDF图片
- 小巧的便签工具knot