#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int c[3000];
int main(void)
{
int n, i, jolly, s;
bool d[3000];
while (scanf("%d", &n) == 1)
{
jolly = 1;
for (i = 0; i < n; i++)
{
d[i] = false;
scanf("%d", &c[i]);
}
for (i = 1; i < n; i++)
{
s = abs(c[i] - c[i-1]);
if (s >= n || s < 1 || d[s])
{
jolly = 0;
printf("Not jolly\n");
break;
}
else
d[s] = true;
}
if (jolly)
printf("Jolly\n");
}
return 0;
}
沒有留言:
張貼留言