| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
RE的可能是因为这样#include <iostream>
using namespace std;
#define MAXN 3005
bool vis[MAXN];
int main()
{
freopen("c:/a.txt","r",stdin);
int i,j,n,x,y,ab,kill;
while(scanf("%d",&n)!=EOF)
{
if(n==1)
{
scanf("%d",&y);
printf("Jolly\n");
continue;
}
kill=0;
fill(vis+1,vis+n,false);
scanf("%d",&x);
for(i=2;i<=n;i++)
{
scanf("%d",&y);
ab=x-y;
if(ab<0)
ab=-ab;
if(ab>n-1||ab==0)
{
kill=1;
break;
}
else
{
if(!vis[ab])
vis[ab]=true;
else
{
kill=1;
break;
}
x=y;
}
}
//如果上方在没输入完全就否决,要处理后面的输入,注,这里引起了RE,其实它多输入了一次,想想为什么吧.
for(;i<=n;i++)
scanf("%d",&y);
if(kill)
printf("Not jolly\n");
else
printf("Jolly\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator