30(已气s)
查看原帖
30(已气s)
1457323
jyx130320楼主2025/7/18 21:56
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s="";
    cin>>s;
    int W11=0,L11=0,W21=0,L21=0,l=s.size();
    string s1;
    while(cin>>s1)s+=s1;
    for(int i=0;i<s.size();i++){
        if(s[i]=='E'){
            l=i;
            break;
        }
    }
    for(int i=0;i<l;i++){
        if(s[i]=='W'){
            W11++;
        }else L11++;
        if(W11+L11==11){
            cout<<W11<<":"<<L11<<endl;
            W11=0;
            L11=0;
        }
    }
    if(W11!=0||L11!=0)cout<<W11<<":"<<L11<<endl;
    cout<<endl;
    for(int i=0;i<l;i++){
        if(s[i]=='W'){
            W21++;
        }else L21++;
        if(W21+L21==21){
            cout<<W21<<":"<<L21<<endl;
            W21=0;
            L21=0;
        }
    }
    if(W21!=0||L21!=0)cout<<W21<<":"<<L21<<endl;
    return 0;
}

https://www.luogu.com.cn/record/225383805

2025/7/18 21:56
加载中...