本地能过 为嘛交上去编译错误
查看原帖
本地能过 为嘛交上去编译错误
524160
Lin_Master楼主2024/5/12 10:25
#include <bits/stdc++.h>
#include <cstring>
using namespace std;

typedef long long ll;
stack<char> st_wrt[10005], st_wrt_now;
ll wrt_num, check_num, rig_word, kmp;
double t;

int main () {
    char input[100005];
    while (1) {
        gets(input);
        ll input_l = strlen(input);
        if (input[0] == 'E' && input[1] == 'O' && input[2] == 'F') {
            break;
        }  
        wrt_num++;
        for (int i = 0; i < input_l; ++i) {
            if (input[i] == '<' && !st_wrt[wrt_num].empty()) {
                st_wrt[wrt_num].pop();
            }
            if ((input[i] >= 'a' && input[i] <= 'z') || input[i] == '.' || input[i] == ' ') {
                st_wrt[wrt_num].push(input[i]);
            }
        }
    }
    while (1) {
        gets(input);
        ll input_l = strlen(input);
        if (input[0] == 'E' && input[1] == 'O' && input[2] == 'F') {
            break;
        }
        check_num++;
        for (int i = 0; i < input_l; ++i) {
            if (input[i] == '<' && !st_wrt_now.empty()) {
                st_wrt_now.pop();
            }
            if ((input[i] >= 'a' && input[i] <= 'z') || input[i] == '.' || input[i] == ' ') {
                st_wrt_now.push(input[i]);
            }
        }
        stack<char> tmp1, tmp2;
        while(!st_wrt[check_num].empty()){
            tmp1.push(st_wrt[check_num].top());
            st_wrt[check_num].pop();
        }
        while(!st_wrt_now.empty()){
            
            tmp2.push(st_wrt_now.top());
            st_wrt_now.pop();
        }
        int leng = min(tmp1.size(), tmp2.size());
        for (int i = 1; i <= leng; ++i) {
            if (tmp1.top() == tmp2.top()) {
                rig_word++;
            }
            tmp1.pop(); tmp2.pop();
        }
    }
    cin >> t;
    kmp = rig_word *60.0 / t + 0.5;
    cout << kmp << endl;
    return 0;
}
2024/5/12 10:25
加载中...