4008 在线评测系统

img

img

img


能帮忙看看为什么答案错误吗 有更好的题解吗

#include <iostream>
#include <string>

std::string read()
{
    bool start = false;
    std::string buffer;
    std::string string;
    while (std::getline(std::cin, buffer))
    {
        if (buffer == "START")
        {
            start = true;
            continue;
        }
        if (buffer == "END")
            break;
        if (start)
            string += buffer;
    }
    return string;
}

std::string simplify(const std::string &string)
{
    std::string str;
    for (auto c : string)
        if (!std::isspace(c))
            str.push_back(c);
    return str;
}

int main()
{
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++)
    {
        std::string answer = read();
        std::string result = read();
        if (answer == result)
            std::cout << "Accepted" << std::endl;
        else if (simplify(answer) == simplify(result))
            std::cout << "Presentation Error" << std::endl;
        else
            std::cout << "Wrong Answer" << std::endl;
    }
    return 0;
}
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632