题解:P1152 欢乐的跳
首先计算相邻两个数的差的绝对值,然后将差值从小到大排序,如果第
注意:差值数组只有
#include <bits/stdc++.h>
using namespace std;
int n;
int a[1005], c[1005];
int main() {
cin>>n;
for (int i = 1; i <= n; i++) cin>>a[i];
for (int i = 1; i < n; i++) c[i] = abs(a[i] - a[i + 1]);
sort(c + 1, c + n);
for (int i = 1; i < n; i++) {
if (c[i] != i) {
cout<<"Not jolly";
return 0;
}
}
cout<<"Jolly";
return 0;
}