#include <stdio.h>
#include <memory.h>
int Array[3000];
int jolly(int length)
{
int i,temp;
int filter[3000]={0};
for(i=0;i<length-1;i++)
{
temp = Array[i+1]-Array[i];
if(temp<0) temp = -temp;
if(temp<1 || temp>=length || filter[temp] == 1) return 0;
filter[temp] = 1;
}
return 1;
}
int main()
{
int num,i;
while(scanf("%d",&num)!= EOF){
memset(Array,0,sizeof(Array));
for(i=0;i<num;i++)
scanf("%d",&Array[i]);
printf("%s\n",jolly(num)==1?"Jolly":"Not jolly");
}
return 0;
}
UVa 10038 Jolly Jumpers
最新推荐文章于 2018-12-05 11:25:33 发布