提交时间:2019-12-07 11:16:01
运行 ID: 2719
#include<iostream> using namespace std; int main(){ int n; scanf("%d",&n); int a[101]={0}; int b[101]={0}; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i;i<=n;i++){ b[i]=a[i+1]-a[i]; b[i]=b[i]>0?b[i]:-b[i]; } for(int i=1;i<n;i++){ for(int j=n;j<=1;j--){ if(b[i+1]<b[i]){ int t=b[i]; b[i]=b[i+1]; b[i+1]=t; } } int shu=0; for(int i;i<=1;i++){ if(b[i+1]-b[i]==1) shu++; } for(int i;i<=1;i++){ if(b[i+1]-b[i]==1) shu++; } if(shu==n-2) printf("Jolly"); else printf("Not jolly"); return 0; } }