A. Next Test

链接:https://codeforces.com/problemset/problem/27/A

«Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test.

You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests.

Input

The first line contains one integer n (1 ≤ n ≤ 3000) — the amount of previously added tests. The second line contains n distinct integers a1, a2, ..., an (1 ≤ ai ≤ 3000) — indexes of these tests.

Output

Output the required default value for the next test index.

Examples

input

Copy

3
1 7 2

output

Copy

3

代码:

#include<bits/stdc++.h>
using namespace std;
long long n,t,l,r,k,s,d,max1=0,b,c,mod=1e9+7;
long long a[100005];
map<long long,long long>m,p;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>t;
		m[t]++;
	}
	for(int i=1;i<=3001;i++)
	{
		if(m[i]==0)
		{
			cout<<i;
			break;
		}
	}
} 

 

全部评论

相关推荐

od现在都成这样了&nbsp;就业市场真是crazy
牛客473059135号:没事,我有个朋友是985本硕学计算机的,被华为卡目标院校了简历挂,不过不是od虽然人家拿到一堆别的offer了就挺搞笑的属于是……
点赞 评论 收藏
分享
千疮百孔的象牙塔:我也在捣鼓im,你这个im好奇怪的样子,单看简历get不到点,im的消息及时性,消息可靠性,然后系统的可扩展性这几个关键问题都是怎么解决的从简历描述get不到,具体说消息怎么传,消息怎么推送,消息怎么存,消息安全怎么做的这些点感觉对应不起来
点赞 评论 收藏
分享
喜欢喜欢喜欢:这是我见过最长最臭的简历
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务