~cpp #include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int testcase, preNum, currentNum, i; char temp[50000]; vector<int> numList; int main() { while(cin>>testcase) { if(testcase==0 || testcase==1) { cin>>preNum; cout <<"Jolly"<<endl; } else { cin>>preNum; for(i=1; i<testcase; i++) { cin >> currentNum; numList.push_back(abs(currentNum-preNum)); preNum = currentNum; } cin.getline(temp, 50000); sort(&numList[0], &numList[numList.size()]); for(i=0; i<testcase-1; i++) { if(numList[i]!=i+1) { cout <<"Not jolly"<<endl; break; } if(i==testcase-2) cout <<"Jolly"<<endl; } for(i=0; i<numList.size(); i++) numList.erase(numList.begin()+i); numList.clear(); } } return 0; }