7.22 第二场 I love 114514

I love 114514

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 247 Accepted Submission(s): 195

Problem Description

Mr.I loves 114514 very much.

Now Mr.I has a string, if “114514” is a substring of this string, then Xiaoi will also love this string.

Please judge whether Xiaoi loves this string, if Xiaoi loves this string, output “AAAAAA”, otherwise output “Abuchulaile”.

Input

The first line contains an integer T(T ≤ 10) . Then T test cases follow.

Each test case contains a string s(1 ≤ |S| ≤ 105).

Output

For each test case, output a single line contain the answer for the test case.

Sample Input

2
114514
1919810

Sample Output

AAAAAA
Abuchulaile

大概题意

判断所给字符串中有没有114514子串。

思路

直接暴力匹配就可

代码

//
// Created by Black on 2021/7/22.
//

#include <iostream>

using namespace std;
string p = "114514";
string s;
int t;

int main() {
    cin >> t;
    while (t--) {
        cin >> s;
        bool flag = false;
        for (int i = 0; i + p.length() <= s.length(); ++i) {
            if (s.substr(i, p.length()) == p) {
                flag = true;
                break;
            }
        }
        if (flag)
            cout << "AAAAAA" << endl;
        else
            cout << "Abuchulaile" << endl;
    }
    return 0;
}
posted @   嘿,抬头!  阅读(32)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
· 为什么 退出登录 或 修改密码 无法使 token 失效
点击右上角即可分享
微信分享提示