第9测试点错,但下载数据后测试结果为正确(C++98)
查看原帖
第9测试点错,但下载数据后测试结果为正确(C++98)
1357413
Octopus_hsfzy楼主2024/9/6 20:05
#include <bits/stdc++.h>
using namespace std;
long long n,a[5005],x;
bool s[5005];
int main(){
	cin>>n;
	cin>>a[1];
	for(int i=2;i<=n;i++){
		scanf("%lld",&a[i]);
		x=abs(a[i]-a[i-1]);
		if(x>=1&&x<=n-1) s[x]=true;
	}
	for(int i=1;i<n;i++){
		if(!s[x]){
			cout<<"Not jolly";
			return 0;
		}
	}
	cout<<"Jolly";
	return 0;
}
2024/9/6 20:05
加载中...