1.

import java.util.Scanner;
import java.util.Stack;
import java.lang.reflect.Array;

/**
* Created by IntelliJ IDEA.
* User: Bernd Mayer
* Date: 07.10.2009
* Time: 14:14:21
* To change this template use File | Settings | File Templates.

Runtime: 0.412
*/
public class Main {

public static void main(String ...srgs)
{
Scanner sc = new Scanner(System.in);

while(sc.hasNextInt())
{
int count = sc.nextInt();

int last = sc.nextInt();
int diffs[] = new int[count];

for (int i = 0;i < count-1; i++)
{
int current = sc.nextInt();
if (current > last)
{
diffs[i] = current - last;
}
else
{
diffs[i] = last - current;
}
last = current;
}
java.util.Arrays.sort(diffs);
boolean jolly = true;
for (int i = 1;i < count; i++)
{
if (diffs[i] != diffs[i-1] + 1)
{
jolly = false;
}
}

if (!jolly)
System.out.println("Not jolly");
else
System.out.println("Jolly");
}
}
}


2.


/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 10038 - Jolly Jumpers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=12&problem=979&mosmsg=Submission+received+with+ID+7502525
*
* @author Felix Dietrich
* @version 1.0, 10/22/2009
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.428
*/

import java.util.Scanner;

public class Main
{
public static void main(String... s)
{
int n;

Scanner sc = new Scanner(System.in);
boolean distances[];
int current;
int last = 0;
boolean notjolly;

while (sc.hasNext())
{
n = sc.nextInt();
distances = new boolean[n - 1];
notjolly = false;

for (int i = 0; i < n; i++)
{
current = sc.nextInt();
if (i > 0)
{
// only if theres not an equal distance stored before / the distane is valid
if(Math.abs(current-last) > 0 && Math.abs(current-last) < n && distances[Math.abs(current-last)-1] == false)
{
distances[Math.abs(current-last)-1] = true;
}
else
{
notjolly = true;
}
}

last = current;
}

if(notjolly)
System.out.println("Not jolly");
else
System.out.println("Jolly");
}
}
}

3.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 10038 - Jolly Jumpers
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=979
*
* @author Stefan Gohlke
* @version 1.0, 12/09/2009
*
* Method : Ad-Hoc
* Status : accepted
* Runtime: 0.432
*/

package jolly_acc;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
jolly();
}

public static void jolly() {

Scanner scanner = new Scanner(System.in);

int zahl1 = 0;
int zahl2 = 0;
boolean isjolly;

while (scanner.hasNextInt())
{
int n = scanner.nextInt();

if (n>0)
{

int[] zahlen = new int[n];
int[] dif = new int[n];
int arraygroesse = 0;

for (int i=0; i<n;i++)
{
int zwischen = scanner.nextInt();

zahlen[arraygroesse] = zwischen;
arraygroesse++;

}

for (int i = 0; i < arraygroesse; i++) {
zahl1 = zahlen[i];

if (i < arraygroesse - 1) {
zahl2 = zahlen[i + 1];
}

dif[i] = zahl1 - zahl2;
if (dif[i] < 0)
dif[i] = (-1) * dif[i];
}

Arrays.sort(dif);

isjolly = true;
for (int i = 1;i < dif.length; i++ )
{
if (dif[i-1] != dif[i] - 1)
{
isjolly = false;
break;
}
}

if (isjolly)
System.out.println("Jolly");
else
System.out.println("Not jolly");
}


}
}
}