为何过不去
查看原帖
为何过不去
1116801
black_cat666楼主2023/11/28 11:34

为何我过不去?好像测试点跟我得出答案一模一样

#include <iostream>
using namespace std;

int main(){
    char s;
    int win,lose = 0;
    int win1,lose1 = 0;
    int index;
    int arr[62526];
    int arrA[62526];
    int arrB[62526];
    while(cin >> s && s != 'E'){
        if(s == 'L'){
            index++;
            lose++;
            lose1++;
            arr[index]++;
            if(lose >= 11){
                if(lose - win < 2){
                }else{
                    arrA[index]++;
                    lose = 0;
                    win = 0;
                }
            }
            if(lose1 >= 21){
                if(lose1 - win1 < 2){
                }else{
                    arrB[index]++;
                    lose1 = 0;
                    win1 = 0;
                }  
            }
        }else{
            index++;
            win++;
            win1++;
            if(win >= 11){
                if(win - lose < 2){
                }else{
                    arrA[index]++;
                    lose = 0;
                    win = 0; 
                }
            }
            if(win1 >= 21){
                if(win1 - lose1 < 2){
                }else{
                    arrB[index]++;
                    lose1 = 0;
                    win1 = 0;
                }  
            }
        }
    }
    win = 0;
    lose = 0;
    for(int i = 1;i <= index;i++){
        if(arr[i] == 1){
            lose++;
        }else{
            win++;
        }
        if(arrA[i] == 1){
            cout << win << ":" << lose << endl;
            win = 0;
            lose = 0;
        }

    }
    cout << win << ":" << lose << endl;
    win = 0;
    lose = 0;
    
    cout << endl;
    lose1 = 0;
    win1 = 0;
    //21场
    for(int i = 1;i <= index;i++){
        if(arr[i] == 1){
            lose1++;
        }else{
            win1++;
        }
        //结算
        if(arrB[i] == 1){
            cout << win1 << ":" << lose1 << endl;
            win1 = 0;
            lose1 = 0;
        }
    }
    cout << win1 << ":" << lose1 << endl;
    win1 = 0;
    lose1 = 0;
}
2023/11/28 11:34
加载中...