You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
675 B

#include<bits/stdc++.h>//万能头文件
using namespace std;
int main() {
int n;
cin >> n;
int arr[1000] = {0};
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
set<int> s;
for (int i = 1; i < n; i++) {
int x = abs(arr[i] - arr[i - 1]);
s.insert(x);
}
//输出
// set<int>::iterator it;
// for(it=s.begin (); it!=s.end (); it++) {
// printf("%d\n",*it);
// }
for (int i = 1; i <= n - 1; i++) {
if (s.count(i) == 0) {
cout << "Not jolly" << endl;
break;
}
if (i == n - 1) {
cout << "Jolly" << endl;
}
}
return 0;
}