logo AlgoBeat OnlineJudge
登录 注册

题解

作者: tyxx040105  ·  发布于 2026-09-10 13:27:33  ·  最后修改于 2026-09-10 20:47:43
已通过
审核员:AlgoBeat 官方账号 · 2026-09-10 20:47:43

我们可以使用 string 自带的 find() 函数,注意到要依次判断规则三、二、一,然后没了。

#include<bits/stdc++.h>
using namespace std;
long long n,s,t;
int main(){
    ios::sync_with_stdio(0),cin.tie(nullptr);
    cin>>n>>s;
    t=s;
    for(int i=1;i<=n;i++){
        string a;
        cin>>a;
        if(a.find("kirai")!=-1){
            if(t>0) t=0;
        }
        else if(a.find("daishuki")!=-1) t+=2;
        else if(a.find("shuki")!=-1) t++;
        else t--;
        // cout<<t<<'\n';
    }
    if(t<=0) cout<<"shuki";
    else cout<<t-s;
    return 0;
}

暂无评论

登录 后即可评论。