求大佬来改改
查看原帖
求大佬来改改
1198354
wsfz_lmq楼主2023/12/26 22:52

#include <stdio.h>
#include <math.h>

int main()
{
	int n;
	int arr[1005];
	int str[1005];
	scanf("%d",&n);
	for(int i = 0;i < n;i++){
		scanf("%lld",&arr[i]);
		if(i >= 1){
			str[i] = abs(arr[i] - arr[i - 1]);
			if(str[i] >= n){
				printf("Not jolly");
				return 0;
			}
		}
	}
	
	for(int i = 1;i < n;i++){
		int min = str[i];
		for(int j = i;j < n;j++){
			if(min > str[j]){
				int temp = min;
				min = str[j];
				str[j] = temp;
			}
		}
		if(str[i] != i){
			printf("Not jolly");
			return 0;
		}
	}
	printf("Jolly");
	
	return 0;
}
2023/12/26 22:52
加载中...