JollyJumpers ë¬¸ì œí’€ì�´
소ê°� ¶
ë¬¸ì œì�´í•´ì—� ë§Žì�€ 시간ì�´ 걸림
ì˜�어공부를 열심히 í•´ì•¼ê² ë‹¤
ì˜�어공부를 열심히 í•´ì•¼ê² ë‹¤
소스 ¶
~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;
}










