감 ¶
간 걸
공 겠
공 겠
¶
~cpp
#include <iostream>
using namespace std;
int main()
{
int n;
int input[3000];
bool diff[3000]; // 값 값
// 값 1 ~ n-1
int i;
bool isJolly;
while (cin >> n)
{
isJolly = true;
for (i = 0; i < n; i++)
cin >> input[i];
if (n > 1)
{
for (i = 0; i < n; i++)
diff[i] = false;
for (i = 0; i < n - 1; i++)
diff[abs(input[i] - input[i + 1])] = true;
for (i = 1; i <= n - 1; i++)
if (diff[i] == false)
{
isJolly = false;
break;
}
}
if (isJolly == true)
cout << "Jolly\n";
else
cout << "Not jolly\n";
}
return 0;
}










