3 条题解

  • 1
    @ 2024-2-3 8:43:32

    给一发 std:

    // std written by Greenzhe_qwq(uid=7)
    // 2024/1/29
    // clang-format
    
    #include <bits/stdc++.h>
    using namespace std;
    
    char s1[121], s2[121];
    
    bool judge(string speaker, string msg) {
        // Detect emoji
        if (msg.find("/qq") != msg.npos) return true;
        if (msg.find("/yqq") != msg.npos) return true;
        if (msg.find("/bixin") != msg.npos) return true;
    
        // Change all the letters to lower
        for (int i = 0; i < msg.size(); ++i) msg[i] = tolower(msg[i]);
    
        // Detect words
        if (msg.find("meow") != msg.npos) return true;
        if (msg.find("cute") != msg.npos) return true;
        if (msg.find("lovely") != msg.npos) return true;
        if (msg.find("kawaii") != msg.npos) return true;
        if (msg.find("love") != msg.npos) return true;
        if (msg.find("tietie") != msg.npos) return true;
    
        // Detect names
        for (int i = 0; i + 2 < msg.size(); ++i) {
            string sub = msg.substr(i, 3);
            if ((sub == "cyx" || sub == "zzp") && sub != speaker) {
                if (i > 0 && isalpha(msg[i - 1])) continue;
                if (i + 3 < msg.size() && isalpha(msg[i + 3])) continue;
                return true;
            }
        }
    
        // Sadly there's no dog food
        return false;
    }
    
    int main() {
        int T, cyx = 0, zzp = 0;
        scanf("%d\n", &T);
    
        while (T--) {
            scanf("%s : %[^\n]", s1, s2);
            string speaker = s1, msg = s2;
    
            if (speaker == "cyx")
                cyx += judge(speaker, msg);
            else
                zzp += judge(speaker, msg);
        }
    
        printf("%d %d\n", cyx, zzp);
        return 0;
    }
    

    花絮:本题数据大部分都是用《哈姆雷特》完成的。所以假如你打开数据就会发现两人在互相莎士比亚。

    [CZOJ 一周一测 R7 D] Chen Yuxiang x Zhang Zipei FOREVER!

    信息

    ID
    790
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    100
    已通过
    24
    上传者