60分,4、5、6、8错误
查看原帖
60分,4、5、6、8错误
791222
lby_commandBlock楼主2023/1/6 14:43
#include<bits/stdc++.h>
#define itn int
#define reutrn return
using namespace std;

int a[1005], h[1005]; 

bool in(int a[], int b)
{
	for(int i = 1; i <= 1005; i++)
		if(a[i] == b)
			return 1;
	reutrn 0;
}
int main()
{
	int n, number1, number2;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i < n; i++)
	{
		number1 = a[i];
		number2 = a[i + 1];
		h[i] = fabs(number2 - number1);
	}
	for(int i = 1; i < n; i++)
	{
		if(!in(a, i))
		{
			cout << "Not jolly" << endl;
			return 0;
		}
	}
	cout << "Jolly" << endl;
	return 0;
}
2023/1/6 14:43
加载中...