#include "iostream"
#include "memory.h"
#include "cmath"
using namespace std;
int num[3010], ans[3010];
int main()
{
int n, i;
bool tag;
while (cin >> n)
{
tag = false;
if (n == 1)
{
for (i = 1; i <= n; i++)
cin >> num[i];
cout << "Jolly" << endl;
}
else
{
memset(num, 0, sizeof(num));
memset(ans, 0, sizeof(ans));
for (i = 1; i <= n; i++)
cin >> num[i];
for (i = 1; i < n; i++)
{
int temp = abs (double(num[i+1] - num[i]));
if (temp < 1 || temp > n)
{
tag = true;
break;
}
ans[temp] = 1;
}
for (i = 1; i < n; i++)
{
if (ans[i] != 1)
{
tag = true;
break;
}
}
if (!tag)
cout << "Jolly" << endl;
else
cout << "Not jolly" << endl;
}
}
}
zoj 1879 Jolly Jumpers
最新推荐文章于 2019-09-23 21:38:50 发布