#include <iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int main()
{
int array[3000],array1[3000],j,n;
int flag;
while(cin >> n)
{
for(int i = 0; i < n; i++)
{
cin >> array[i];
}
j = 1;
flag=1;
for(int i = 1; i < n; i++)
{
array1[j++] = abs(array[i]-array[i-1]);
}
sort(array1+1,array1+j);
for(int i = 1; i < j; i++)
{
if(array1[i] != i)
{
flag=0;
break;
}
}
if(flag==1)
{
cout << "Jolly" << endl;
}
else
{
cout << "Not jolly" << endl;
}
}
return 0;
}UVA 10038- Jolly Jumpers Solution
Open original problem
Join the discussion
1 previous comment
Today, I went to thee beach with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put thee shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is completely offf topic but I had to tell someone! https://www.waste-ndc.pro/community/profile/tressa79906983/