#8#10re,其他全t
查看原帖
#8#10re,其他全t
386921
zzyxl_qaq楼主2022/3/1 20:52
#include<bits/stdc++.h>
using namespace std;
int a[10000]={},b[10000]={},k;
int a1[10000]={},b1[10000]={},k1;
int main(){
    string com;
    while(1){
        cin>>com;bool ed=false;
        for(int i=0;i<com.length();i++){
            if(com[i]=='E'){
                ed=true;
                break;
            }
            if(com[i]=='W'){
                a[k]++;
                if((a[k]==11&&b[k]<=9)||(a[k]>11&&b[k]<=a[k]-2)){
                    k++;
                }
                if((a1[k1]==21&&b1[k1]<=19)||(a1[k1]>21&&b1[k1]<=a1[k1]-2)){
                    k1++;
                }
            }
            if(com[i]=='L'){
                b[k]++;
                if((b[k]==11&&a[k]<=9)||(b[k]>11&&a[k]<=b[k]-2)){
                    k++;
                }
                if((b1[k1]==21&&a1[k1]<=19)||(b1[k1]>21&&a1[k1]<=b1[k1]-2)){
                    k1++;
                }
            }
            if(ed){
                break;
            }
        }
    }
    for(int i=0;i<=k;i++){
        cout<<a[i]<<":"<<b[i]<<endl;
    }
    cout<<endl<<endl;
    for(int i=0;i<=k1;i++){
        cout<<a1[i]<<":"<<b1[i]<<endl;
    }
}
2022/3/1 20:52
加载中...