CodeForces 682B Alyona and Mex (题意水题)
题意:给定一个序列,你可以对这里面的数用小于它的数来代替,最后让你求,改完后的最大的序列中缺少的最小的数。
析:这个题,读了两个多小时也没读懂,要是读懂了,肯定能做出来。。。没什么可说的,就是尽量凑1 2 3 4 5。。。如果没有了,就输出。
代码如下:
#include <bits/stdc++.h> using namespace std;
const int maxn = 1e5 + 5;
int a[maxn]; int main(){
int n;
while(cin >> n){
for(int i = 0; i < n; ++i) scanf("%d", &a[i]);
sort(a, a+n);
int cnt = 1;
for(int i = 0; i < n; ++i)
if(a[i] >= cnt) ++cnt;
printf("%d\n", cnt);
}
return 0;
}
CodeForces 682B Alyona and Mex (题意水题)的更多相关文章
- Codeforces Round #358 (Div. 2) B. Alyona and Mex 水题
B. Alyona and Mex 题目连接: http://www.codeforces.com/contest/682/problem/B Description Someone gave Aly ...
- CodeForces 682B Alyona and Mex (排序+离散化)
Alyona and Mex 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/B Description Someone gave ...
- CodeForces 682A Alyona and Numbers (水题)
Alyona and Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/A Description After fi ...
- CodeForces - 682B 题意水题
CodeForces - 682B Input The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — ...
- Codeforces 740C. Alyona and mex 思路模拟
C. Alyona and mex time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
- Educational Codeforces Round 7 A. Infinite Sequence 水题
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...
- Codeforces Testing Round #12 A. Divisibility 水题
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...
- Codeforces Beta Round #37 A. Towers 水题
A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...
随机推荐
- Entity Framework API介绍 -- DbSet<>().Find()
过去我们常常使用Where或First(FirstOrDefault)方法来查找对应的实体,比如: var query = context.CertInfoMakeDetails.ToList().W ...
- 代做JSP课程设计,毕业设计
代做JSP课程设计,毕业设计,大家都是学生,绝对靠谱,有意者加我Q 279283855
- linux命令日志处理
刘超 2018/10/8 10:32:43 zcat bi_www_activity_2018100*.log.gz |grep --color '多方电话h5_' | awk -F'|' '{pri ...
- sql语句中避免使用mysql函数,提升mysql处理能力。
如下sql中不要用mysql内置函数now()等,这样第一可以提高sql执行效率,第二统一程序层处理sql中时间参数,避免因服务器时间差导致问题产生. 使用PDO预处理,第一可以提高sql效率,第二可 ...
- GetEnumName 枚举名称 字符串
System.TypInfo.pas System.TypInfo.hpp http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.TypIn ...
- C# unsafe模式内存操作深入探索
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...
- 前端开发之JavaScript基础篇一
主要内容: 1.JavaScript介绍 2.JavaScript的引入方法和输出及注释 3.javaScript变量和命名规则 4.五种基本数据类型 5.运算符 6.字符串处理 7.数据类型转换 ...
- 读书笔记 Week6 2018-4-12
Chap 24 重构 读书笔记 一.需求的变更 单纯就科目学习中的小项目来说,目标在一开始便被明确下来,即可定义一份严谨的列表来描述功能.故在原来的编程经历中,只要上交了程序便一切都没事儿了,也没有重 ...
- Vertex and fragment programs
[Vertex and fragment programs] When you use vertex and fragment programs (the so called "progra ...
- CS API 测试2
//删除数据中心 http://192.168.150.16:8900/client/api?command=deleteZone&id=c2d4f46a-51af-4806-8378-4b3 ...