题目:http://codeforces.com/problemset/problem/653/A
代码:
#include<stdio.h>
#include<string.h>
#include<map>
using namespace std;
int book[10005]={0};
int main()
{
for(int i=0;i<=10005;i++)
book[i]=0;
int n;
scanf("%d",&n);
for(int i=0; i<n; i++)
{
int t;
scanf("%d",&t);
book[t]++;
}
int flag=0;
for(int i=1; i<=1000; i++) // i<=1000 book【2000】也满足条件
{
if(book[i]&&book[i+1]&&book[i+2])
{
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
分析:
离梦想好遥远。从头再来吧。