Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

What is the relationship between humans and nature?

Answered: 1 week ago