1 条题解

  • 1
    @ 2026-8-4 16:34:59

    有些晦涩,不一定能懂,自己看着办吧

    #include <iostream>
    #include <vector>
    #include <string>
    #include <cmath>
    using namespace std;
    
    string process(string s)
    {
        string res;
        for (char ch : s)
        {
            if (ch == '<')
            {
                
                if (!res.empty())
                    res.pop_back();
            }
            else
            {
                res.push_back(ch);
            }
        }
        return res;
    }
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    
        vector<string> article;   
        vector<string> input;     
        string line;
    
        while (getline(cin, line))
        {
            if (line == "EOF") break;
            article.push_back(process(line));
        }
    
        while (getline(cin, line))
        {
            if (line == "EOF") break;
            input.push_back(process(line));
        }
    
        int T;
        cin >> T;
    
        long long correct = 0;
        int line_cnt = min(article.size(), input.size());
        for (int i = 0; i < line_cnt; ++i)
        {
            string &art = article[i];
            string &usr = input[i];
            int len = min(art.size(), usr.size());
            for (int k = 0; k < len; ++k)
            {
                if (art[k] == usr[k])
                    correct++;
            }
        }
    
        int kpm = round(correct * 60.0 / T);
        cout << kpm << endl;
    
        return 0;
    }
    
    • 1

    信息

    ID
    9670
    时间
    2000ms
    内存
    500MiB
    难度
    5
    标签
    递交数
    1
    已通过
    1
    上传者