#1, #2 AC,其它全部 RE
查看原帖
#1, #2 AC,其它全部 RE
802665
Stratus8419楼主2024/6/17 00:55
#include <bits/stdc++.h>

using namespace std;

string sample = "", input = "";

void Inputting(string &target);
void LineBackspacing(string &target);

int main()
{
    bool isInputting = true;

    Inputting(sample);
    Inputting(input);
    
    int rightCharsSum = 0, skippedChars = 0;
    for(int i = 0; i < sample.length(); i++)
    {
        if(input[i + skippedChars] == sample[i] && sample[i] != '\n') rightCharsSum ++;
        if(sample[i] == '\n' && input[i + skippedChars] != '\n') while(!(input[i + skippedChars] == '\n')) skippedChars ++;
    }

    int T = 0;
    cin >> T;
    cout << (int) (rightCharsSum * 60.0 / T + 0.5);

    return 0;
}

void Inputting(string &target)
{
    bool isInputting = true;
    while(isInputting)
    {
        string _smp;
        getline(cin, _smp);
        LineBackspacing(_smp);
        target += _smp + '\n';

        string _end = target.length() >= 5? &target[target.length() - 5] : "Ciallo ~";
        if(_end == "\nEOF\n")
        {
            target.erase(target.length() - 5);
            isInputting = false;
        }
    }
}

void LineBackspacing(string &target)
{
    int backChars = 0, head = 0;
    string _final = target;
    for(int i = 0; i < target.length(); i++)
    {
        _final[i - backChars] = _final[i];
        if(_final[i] == '<')
        {
            if(i - head == 0)
            {
                backChars += 1;
                head += 1;
            }
            else
            {
                backChars += 2;
                head += 2;
            }
        }
    }
    int a = 0;
    _final.erase(_final.length() - backChars);
    target = _final;
}

2024/6/17 00:55
加载中...