|
|||
Jolly JumpersA sequence of n > 0 integers is called a jolly jumper if the absolute values of the differences between successive elements take all the values from 1 to n – 1. For instance, the sequence 1, 4, 2, 3 is a jolly jumper, because the absolute differences are 3, 2, and 1, respectively. The definition implies that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether or not each of a number of sequences is a jolly jumper. Input SpecificationEach line of input starts with an integer n ≤ 3000, followed by n integers, separated by spaces, representing the sequence. The input is terminated by end-of-file (EOF). Output Specification
For each line of input, generate a line of output saying “ Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |