c++
2025-04-19 14:43:57
发布于:江苏
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
const int m = 3000;
bool check(int a[], int n) {
bool b[m] = {false};
for (int i = 1; i < n; ++i) {
int d = abs(a[i] - a[i - 1]);
if (d >= 1 && d <= n - 1) {
b[d] = true;
} else {
return false;
}
}
for (int i = 1; i < n; ++i) {
if (!b[i]) {
return false;
}
}
return true;
}
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[m];
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
if (check(a, n)) {
cout << "Lucky" << endl;
} else {
cout << "Thanks" << endl;
}
}
return 0;
}
这里空空如也
有帮助,赞一个