- import static java.lang.System.*;
- public class main{
- public static void main(String[] args) {
- Scanner sc=new Scanner(System.in);
- while(sc.hasNextInt())
- {
- int size = sc.nextInt();
- boolean is_jolly = true;
- if(size != 1)
- {
- int[] input = new int[size];
- for(int i = 0; i < size; i++)
- input[i] = sc.nextInt();
- int[] dif = new int[size -1];
- for(int i = 0; i < size-1; i++)
- dif[i] = Math.abs(input[i+1] - input[i]);
- Arrays.sort(dif);
- for(int i = 0; i < size-1; i++)
- if(dif[i] != i+1)
- {
- is_jolly = false;
- break;
- }
- }
- else
- sc.nextInt();
- if(is_jolly)
- System.out.println("Jolly");
- else
- System.out.println("Not jolly");
- }
- }
- };
留言
張貼留言