P1042求调,本人最后一个数据点没有过。感谢
查看原帖
P1042求调,本人最后一个数据点没有过。感谢
1458355
CHIHUIZY楼主2025/7/21 20:04
#include<iostream>
#include<cmath>
using namespace std;
char op[62770];
int main(){
    int win=0,lost=0;
    int win1=0,lost1=0;
    char z;
    int i=1;
    bool stulation=true;
    for(i=1; ;i++){
        cin>>z;
        if(z=='E'){
            break;
        }
        op[i]=z;
    }
    for(int j=1;j<=i;j++){
        if(op[j]=='W')win++,win1++;
        if(op[j]=='L')lost++,lost1++;
        if(max(win,lost)>=11&&abs(win-lost)>=2){
            stulation=false;
            cout<<win<<':'<<lost<<endl;
            win=0;lost=0;
        }
    }
    if(win!=0||lost!=0){
        stulation=false;
        cout<<win<<':'<<lost<<endl;
        win=0;lost=0;
    }
    if(stulation==true){
        cout<<"0:0"<<endl;
    }
    cout<<endl;
    stulation=true;
    for(int j=1;j<=i;j++){
        if(op[j]=='W')win++;
        if(op[j]=='L')lost++;
        if(max(win,lost)>=21&&abs(win-lost)>=2){
            stulation=false;
            cout<<win<<':'<<lost<<endl;
            win=0;lost=0;
        }
    }
    if(win!=0||lost!=0){
        stulation=false;
        cout<<win<<':'<<lost<<endl;
        win=0;lost=0;
    }
    if(stulation==true){
        cout<<"0:0"<<endl;
    }
    return 0;
}
2025/7/21 20:04
加载中...