![:cry:](./images/smilies/icon_cry.gif)
![:roll:](./images/smilies/icon_rolleyes.gif)
the [cpp] code :
#include<iostream.h>
#include<math.h>
int main()
{
long n=0;
long num[3000]={0};
while(cin >> n)
{
for(long l=0;l<n;l++)
{
cin >> num[l];
}
long v=0,vv=0,dif=0;
int fg=0;
for(long f=0;f<(n-2);f++)
{
v=labs(num[f]-num[f+1]);
vv=labs(num[f+1]-num[f+2]);
dif=labs(v-vv);
if(dif==1)fg=1;
else fg=0;
}
if(fg==1)cout << "Jolly" << endl;
else cout << "Not jolly" << endl;
n=0;num[0]=0;
}
return 0;
}
[/cpp]