50分,只会输出Not jolly
查看原帖
50分,只会输出Not jolly
565707
mediocre_楼主2022/12/21 11:53
#include<bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, a[N], b[N];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n - 1; ++i, b[i] = abs(a[i] - a[i + 1]));
	bool cmp = false;
	for (int i = 1; i <= n - 1; ++i, cmp = (b[i] != b[i + 1] + 1 || cmp == true) ? true : false);
	if (cmp == false)printf("Jolly");
	else printf("Not jolly");
	return 0;
}
2022/12/21 11:53
加载中...