样例已过,也下载了第一组数据
第一组输入为 4 1 4 2 3,输出为Jolly,都没有问题,为什么RE?蒟蒻不解。
![输入输出]()
代码如下
#include<bits/stdc++.h>
using namespace std;
const int mx=1010;
bool a[mx];
int n;
int main(){
cin>>n;
memset(a,sizeof(a),false);
int sh,th;
for(int i=0;i<n;i++){
cin>>th;
a[abs(th-sh)]=true;
sh=th;
}
for(int i=1;i<=n-1;i++){
if(!a[i]){
cout<<"Not jolly"<<endl;
return 0;
}
}
cout<<"Jolly"<<endl;
return 0;
}
大佬求教!!