Question: C PROGRAM. Multi-Jolly Jumper A sequence of n>0 integers is called a jolly jumper if the absolute values of the dierences between successive elements are

C PROGRAM. Multi-Jolly Jumper

A sequence of n>0 integers is called a jolly jumper if the absolute values of the dierences between successive elements are in ascending or descending order. For instance,

1 4 2 3

is a jolly jumper, because the absolute differences are in descending order 3, 2, and 1, respectively. The denition implies that any sequence of a single integer is a jolly jumper. Write a program to determine whether each of a number of sequences is a jolly jumper. Another example:

1 3 6 10

Is a jolly jumper, because the absolute differences are in ascending order: 2,3, and 4

Input Each line of input contains an integer n<3,000 followed by n integers representing the sequence.

Output For each line of input generate a line of output saying Jolly or Not jolly.

Input

Each line of input contains an integer n<3,000 followed by n integers representing the sequence.

Output

For each line of input generate a line of output saying Jolly or Not jolly. If Jolly, indicate if it is in ascending or descending order.

Sample Input

4 1 4 2 3

5 1 4 2 -1 6

4 1 3 6 10

Sample Output

Jolly descending

Not jolly

Jolly ascending

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!