What情况!!!c++14 O2得80分,不开O2得100分!
查看原帖
What情况!!!c++14 O2得80分,不开O2得100分!
1492018
noiiloveyou楼主2024/11/22 18:45
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a[1005],c[1005];
	long long n,temp;
	long long j=1;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++){
		temp=a[i]-a[i+1];
		if(temp<0) temp=-temp;
		c[i]=temp;
	}
	temp=1;
	sort(c,c+n);
	for(int i=1;i<n-1;i++){
		//cout<<c[i]<<' '<<temp<<endl;
		if(c[i]!=temp) j=0;
		temp++;
	}
	//for(int i=0;i<n;i++) cout<<c[i]<<' ';
	if(j==1) cout<<"Jolly";
	else cout<<"Not jolly";
	return 0;
} 
2024/11/22 18:45
加载中...