CodeForces - 682B

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of elements in the Alyona's array.

The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the array.

Output

Print one positive integer — the maximum possible value of mex of the array after Alyona applies some (possibly none) operations.

求更改后数列中没有的最小整数,不知更改,只能求最大可能

构成1 2 3 4.。

对于5 6 7  1 2 3

#include "cstdio"
#include "iostream"
#include "string"
#include "cstring"
#include "cmath"
#include "vector"
#include "map"
#include "algorithm"
using namespace std;
int a[];
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
int min1=;
for(int i=;i<n;i++)
if(a[i]>min1)//可改
++min1;///最大可能+1
printf("%d\n",min1+);
}
}

最新文章

  1. 利用颜色生成UIImage
  2. 在Windows/Ubuntu下安装OpenGL环境(GLUT/freeglut)与跨平台编译(mingw/g++)
  3. Drupal 7.23版本升级笔记
  4. Spring AOP 系列总括
  5. HTTP协议的几个概念
  6. memory CPU cache books
  7. PouchDB:可随时同步的开源JavaScript数据库
  8. TCP/IP协议简单介绍
  9. 【实用技巧】去除BootStrap所有圆角效果
  10. 同花顺核新下单程序的&quot;界面不操作超时时间&quot;的设定
  11. 01--数据库MySQL:【数据库DB】和【数据库管理系统DBMS】 简介
  12. 201621123060《JAVA程序设计》第十三周学习总结
  13. spring-cloud-sleuth 和 分布式链路跟踪系统
  14. HTML的Tomcat
  15. FPGA计算中定标与位扩展的实现
  16. Java虚拟机--Java内存区域的划分和异常
  17. 如何将数组中的后面m个数移动为前面m个数
  18. spark-client 一直 accepted,无法提交任务,报错Failed to connect to driver at
  19. OpenCV - Linux(Ubuntu 16.04)中安装OpenCV + OpenCV_Contrib
  20. ios实现分发下载

热门文章

  1. BFS 队列
  2. hive报错:Caused by: ERROR XBM0H: Directory /var/lib/hive/metastore/metastore_db cannot be created.
  3. 添加用户-查看用户列表-禁止默认root登陆
  4. 「日常训练」「小专题·图论」 Cow Contest (1-3)
  5. java---解析XML文件,通过反射动态将XML内容封装到一个类中
  6. 13.0 Excel表格写入
  7. Ubuntu 常见错误及解决方法——长期不定时更新
  8. 图解Transformer
  9. eth day05
  10. C++ Profiler工具之初体验