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.
29 lines
633 B
29 lines
633 B
#include<bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 1010;
|
|
int a[N];
|
|
|
|
unordered_set<int> s;
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++) cin >> a[i];
|
|
|
|
for (int i = 1; i < n; i++) {
|
|
int x = abs(a[i] - a[i - 1]);
|
|
s.insert(x);
|
|
}
|
|
|
|
for (int i = 1; i <= n - 1; i++) {
|
|
//如果发现缺失,就不是欢乐的跳
|
|
if (s.count(i) == 0) {
|
|
cout << "Not jolly" << endl;
|
|
exit(0);
|
|
}
|
|
//如果成功到达最后,就是欢乐的跳
|
|
if (i == n - 1) cout << "Jolly" << endl;
|
|
}
|
|
return 0;
|
|
} |