求hack(80pts WA)
查看原帖
求hack(80pts WA)
764666
LostKeyToReach楼主2024/8/24 11:33

将目前讨论区的所有 hack 数据都过掉了。

#include <iostream>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        string s;
        cin >> s;
        bool ok = 1;
        int l = 0, r = (int)s.size() - 1;
        while (l <= r) {
            if (s[l] == s[r]) l++, r--;
            else if (s[r] == 'l' || s[r] == 'q' || s[r] == 'b') r--;
            else {
                ok = 0;
                break;
            }
        }
        cout << (ok ? "Yes\n" : "No\n");
    }
}
2024/8/24 11:33
加载中...