sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1.
水题。。
#include<stdio.h>
#include<math.h>
int main()
{
int a[3005],i,x,y,flag,n,d;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<3005;i++)a[i]=0;
scanf("%d",&x);
flag=0;
for(i=1;i<n;i++)
{
scanf("%d",&y);
d=abs(y-x);
if(d>=n||d==0||a[d])flag=1;
else
a[d]=1;
x=y;
}
if(flag)printf("Not jolly\n");
else
printf("Jolly\n");
}
return 0;
}