题意:给定一个序列,你可以对这里面的数用小于它的数来代替,最后让你求,改完后的最大的序列中缺少的最小的数。

析:这个题,读了两个多小时也没读懂,要是读懂了,肯定能做出来。。。没什么可说的,就是尽量凑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 (题意水题)的更多相关文章

  1. 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 ...

  2. CodeForces 682B Alyona and Mex (排序+离散化)

    Alyona and Mex 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/B Description Someone gave ...

  3. CodeForces 682A Alyona and Numbers (水题)

    Alyona and Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/A Description After fi ...

  4. CodeForces - 682B 题意水题

    CodeForces - 682B Input The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — ...

  5. Codeforces 740C. Alyona and mex 思路模拟

    C. Alyona and mex time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...

  6. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

  7. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  8. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  9. Codeforces Beta Round #37 A. Towers 水题

    A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...

随机推荐

  1. 继承String?

    不能继承,因为 public final class String extends Objectimplements Serializable, Comparable<String>, C ...

  2. php对业务平台接口调用的封装格式

    1.封装类示例:E:\html\pim\php_mcloud_cas\util\UmcPlatform.class.php <?php class Util_UmcPlatform{ const ...

  3. rabbitMQ消息队列1

    rabbitmq 消息队列 解耦 异步 优点:解决排队问题 缺点: 不能保证任务被及时的执行 应用场景:去哪儿, 同步 优点:保证任务被及时的执行 缺点:排队问题 大并发 Web nginx 1000 ...

  4. [js方法pk]之instanceof() vs isPrototypeOf() hasOwnProperty() vs propertyIsEnumerable()

    这几个方法在js的高级编程中经常用到,对于新手来说可能还不知道他们有什么区别,我把我的体会总结下来,供大家参考: 首先,定义一个对象: function Parent() {this.name = & ...

  5. Linux下编译、安装php

    一.apache环境下php的安装步骤如下:[注意:编译安装php前,应先安装好apache,因为编译php时要用到apache的路径] 1. 在http://www.php.net/download ...

  6. Python格式符说明

    格式化输出 例如我想输出 我的名字是xxxx 年龄是xxxx name = "Lucy"age = 17print("我的名字是%s,年龄是%d"%(name, ...

  7. ubuntu 18.04 - server版 开机启动脚本

    ubuntu 18.04 不再使用 inited 管理系统,改用 systemd systemd 默认读取 /etc/systemd/system 下的文件,该目录下的文件会链接/lib/system ...

  8. 【jdbc】【c3p0】c3p0三种配置方式【整理】

    c3p0三种配置方式 c3p0的配置方式分为三种,分别是1.setters一个个地设置各个配置项2.类路径下提供一个c3p0.properties文件3.类路径下提供一个c3p0-config.xml ...

  9. 分别用js和css实现瀑布流

    下午查找了瀑布流的相关原理,找了一些css3实现的还有js实现的,最后总结了一些比较简单的,易懂的整理起来 1.css3实现 只要运用到    column-count分列 column-width固 ...

  10. Phong Shading

    [Phong Shading] The most serious problem with Gouraud shading occurs when specular highlights are fo ...