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.

23 lines
572 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
int a[N], c[N];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);//读入
for (int i = 1; i < n; i++) c[i] = abs(a[i] - a[i + 1]);//处理差
//按差值由小到大排序
sort(c + 1, c + n);
//检查一下缺少哪个数字缺少的条件是c[i]==i
for (int i = 1; i < n; i++) {
if (c[i] != i) {
printf("Not jolly");
return 0;
}
}
printf("Jolly");
return 0;
}