Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Last active January 3, 2016 23:29
Show Gist options
  • Save KT-Yeh/8535289 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8535289 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
// freopen("input.txt","rt",stdin);
int N;
while (scanf("%d",&N)!=EOF){
int s[3001],check[3001]={0};
bool ok=1;
scanf("%d",&s[0]);
for (int i=1; i<N; i++) {
scanf("%d",&s[i]);
int temp = abs(s[i]-s[i-1]);
if (temp<=3000) check[temp]++;
}
for (int i=1;i<N;i++)
if (check[i]==0) { ok = 0; break; }
if (ok) printf("Jolly\n");
else printf("Not jolly\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment