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

析:这个题,读了两个多小时也没读懂,要是读懂了,肯定能做出来。。。没什么可说的,就是尽量凑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. JavaScript 数组some()和filter()

      some方法 array1.some(callbackfn[, thisArg]) 对数组array1中的每个元素调用回调函数callbackfn,当回调函数返回true或者遍历完所有数组后,so ...

  2. Servlet文件上传和下载的复习

    上传 使用Servlet完成上传和下载相较于使用Struts框架有点麻烦,毕竟更偏底层了 项目中主要使用的jar包: commons-io-2.2.jar  commons-fileupload-1. ...

  3. open the flashback

    1.打开flashback: 关闭数据库 启动到mount方式 SQL>startup mount; 如果归档没有打开,打开归档[因为flashback依赖Media recovery,所以在打 ...

  4. 为什么 ReactJS 不适合复杂的前端项目?

    问题一:ReactJS组件难以在复杂交互页面中复用 ReactJS中的最小复用单位是组件.ReactJS的组件比AngularJS的Controller和View 要轻量些. 每个组件只需要前端开发者 ...

  5. IDA Pro 权威指南学习笔记(十二) - IDA 中的注释

    注释有助于以一种更高级的方式描述汇编语言指令序列 IDA 提供了几种不同类型的注释,每种注释适用于不同的目的 使用 Edit -> Comments 命令的选项,可以为反汇编代码清单中的任何一行 ...

  6. MonkeyScript测试命令集合

    MonkeyScript:(不支持截屏) 可以被Monkey识别的集合命令 可以完成重复固定的操作   MonkeyRunner(支持截屏操作) 提供一系列API,可以完成模拟事件和截屏操作   Mo ...

  7. LCS(最长公共子序列)动规算法正确性证明

    今天在看代码源文件求diff的原理的时候看到了LCS算法.这个算法应该不陌生,动规的经典算法.具体算法做啥了我就不说了,不知道的可以直接看<算法导论>动态规划那一章.既然看到了就想回忆下, ...

  8. 新浪微博Oauth2.0授权 获取Access Token

    新浪微博开放平台提供了丰富的API接口,利用这些接口,开发者能够开发出独具特色的微博应用.但是,大部分接口都需要用户授权给应用,应用利用授权得到的Access Token来调用相应的接口来获取内容. ...

  9. Netty的ChannelHandler,ChannelHandlerContext,ChannelPipeline

    本小节一起学习一下ChannelHandler,ChannelHandlerContext,ChannelPipeline这三个Netty常用的组件,不探究它们的底层源码,我们就简单的分析一下用法 首 ...

  10. 使用ssh client与bash scripts轻松管理多台主机

    当我们需要控制一个局域网中的很多台服务器时,一个简单的全局操作可能会被放大地异常繁琐,这时我们就会需要新的工具来快速完成这种工作. 我们将使用ssh客户端提供的一些工具来快速完成这一开发工作,我们的开 ...