P5587求调,后五个点紫了
  • 板块题目总版
  • 楼主123xiayicheng
  • 当前回复1
  • 已保存回复1
  • 发布时间2022/12/31 09:57
  • 上次更新2023/10/24 06:03:50
查看原帖
P5587求调,后五个点紫了
352913
123xiayicheng楼主2022/12/31 09:57
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s1[10010], s2[10010], tmp;
int T, cnt, n = -1, m = -1;
int main()
{
    while (1)
    {
        getline(cin, tmp);
        if (tmp == "EOF")
            break;
        n++;
        int t=tmp.size();
        for (int i = 0; i < t; i++)
        {
            if (tmp[i] == '<' and !s1[n].empty())
                s1[n].pop_back();
            else if (tmp[i] != '<' and ((tmp[i]>='a' and tmp[i]<='z')or (tmp[i]==' ') or (tmp[i]=='.')))
                s1[n].push_back(tmp[i]);
            }
//      cout<<1;
    }

    while (1)
    {
        getline(cin, tmp);
        if (tmp == "EOF")
            break;
        if (m>n)
            break;
        m++;
        int t=tmp.size();
        for (int i = 0; i < t; i++)
        {
            if (tmp[i] == '<' and !s1[m].empty())
                s2[m].pop_back();
            else if (tmp[i] != '<' and ((tmp[i]>='a' and tmp[i]<='z')or (tmp[i]==' ') or (tmp[i]=='.')))
                s2[m].push_back(tmp[i]);
        }
        t=min(s1[m].size(),s2[m].size());
        for(int i=0;i<t;i++)
        {
        if(s2[m][i]==s1[m][i])
            cnt++;
//      cout<<cnt<<endl;
        }

    }
    scanf("%d",&T);
    long long l=(cnt*60.0/T+0.5);
    cout<<l;
    return 0;
}

1

2022/12/31 09:57
加载中...