为什么最后一个WA了
查看原帖
为什么最后一个WA了
227977
newbeeglass楼主2022/6/28 19:05
#include<bits/stdc++.h>
using namespace std;
int main() {
    char a[300000];
    int x=0;
    while(a[x]!='E'){
        cin>>a[x];
        if(a[x]=='E'){
            break;
        }
        x++;        
    }
    if(strlen(a)==1){
    	cout<<"0:0"<<endl<<endl<<"0:0";
    	return 0;
	}
    int temp1=0,temp2=0,cs=0;
    for(int i=0;i<x;i++){
        if(a[i]=='W'){
            temp1++;
        }
        else{
            temp2++;
        }
        if((temp1>=11 || temp2>=11) && abs(temp1-temp2)>=2){
            cout<<temp1<<":"<<temp2<<endl;
            temp1=0;
            temp2=0;
            
        }
        else if(i==x-1){
            cout<<temp1<<":"<<temp2<<endl;
            temp1=0;
            temp2=0;
        }
    }
    cout<<endl;
    for(int i=0;i<x;i++){
        if(a[i]=='W'){
            temp1++;
        }
        else{
            temp2++;
        }
        if((temp1>=21 || temp2>=21) && abs(temp1-temp2)>=2){
            cout<<temp1<<":"<<temp2<<endl;
            temp1=0;
            temp2=0;
            
        }
        else if(i==x-1){
            cout<<temp1<<":"<<temp2<<endl;
            temp1=0;
            temp2=0;
        }
    }
}

2022/6/28 19:05
加载中...