c++50分求助

P1042 [NOIP2003 普及组] 乒乓球

xhlycyz @ 2024-07-24 17:05:40

//https://www.luogu.com.cn/problem/P1042
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
using namespace std;

int main(){
    char temp;
    int w11=0,l11=0,w21=0,l21=0,sum11=0,sum21=0;
    vector<int> out11,out21;

    while(scanf("%c",&temp)){
        if(temp=='W') {w11++;w21++;sum11++;sum21++;}
        else if(temp=='L') {l11++;l21++;sum11++;sum21++;}

        if(sum11==11||temp=='E'){
            out11.push_back(w11);
            out11.push_back(l11);
            sum11=0;l11=0;w11=0;
        }
        if(sum21==21||temp=='E'){
            out21.push_back(w21);
            out21.push_back(l21);
            sum21=0;l21=0;w21=0;
        }

        if(temp=='E')break;
    }

    for(int i=0;i<out11.size();i++){
        if(i%2==0) cout<<out11[i]<<":";
        else cout<<out11[i]<<"\n";
    }
    cout<<"\n";
    for(int i=0;i<out21.size();i++){
        if(i%2==0) cout<<out21[i]<<":";
        else cout<<out21[i]<<"\n";
    }
}

求助:一直是50分,之前尝试过将输出信息分别存为两个string字符串,现在改成了用vector,依然是50分。

请求大佬帮助,非常感谢


|