acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • c++

    #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; }

    userId_undefined

    139****5266

    倔强青铜
    8阅读
    0回复
    1点赞
首页