50分,大佬求助
查看原帖
50分,大佬求助
206478
Desire_mxx楼主2022/4/29 20:05
#include <bits/stdc++.h>
using namespace std;
int f(int a){
	int b;
	b=-a;
	if(a>0)	
		return a;
	else 
		return b;	
} 
int main(){
	long a[10000],b[10000];
	int n,cnt=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int j=1;j<n;j++){
		int sum=a[j]-a[j+1];
		b[j]=f(sum);
	} 
	for(int k=1;k<=n;k++){
		cnt=0;
		for(int m=1;m<n;m++){
			if(b[k]==a[m])
				cnt++;
		}
		if(cnt==0){
			cout<<"Not jolly"<<endl;
			return 0;
		}
	}
	cout<<"Jolly"<<endl;
	return 0;
}

1,4,5,6,8实在是过不了了,求助呜呜呜@·@

2022/4/29 20:05
加载中...