50分求助,是超了吗还是咋,
查看原帖
50分求助,是超了吗还是咋,
1298000
HeyuNas楼主2024/3/19 20:00
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
//struct stu {
//	string sum;
//	int id;
//	int lenx;
//};

int a[1000] = { 0 };//桶排序,以a的元素下的值是否>0判断;
int b[1001] = { 0 };//装元素
int main()
{
	int i, j = 0, k, sum = 0, count = 0, n, m;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> b[i];
	}

	for (j = 2; j <= n; j++)
	{
		a[abs(b[j] - b[j - 1])]++;

	}
	for (m = 1; m < n; m++)
	{
		if (a[m] == 0)
			break;
	}
	if (m != n)
		cout << "Not jolly";
	else
		cout << "Jolly";
	return 0;
}
2024/3/19 20:00
加载中...