30pts求助!!!!!

P1042 [NOIP2003 普及组] 乒乓球

Sunnnnnn @ 2024-06-29 10:09:25

#include<bits/stdc++.h>
using namespace std;
int W12[2501],L12[2501],W21[2501],L21[2501],id1=1,id2=1;
int main(){
    char s;
    while(cin>>s&&s!='E'){
        if(W12[id1]+L12[id1]>=11)
            id1++;
        if(W12[id1]+L12[id1]<11){
            if(s=='W')W12[id1]++;
            if(s=='L')L12[id1]++;
        }
        if(W21[id2]+L21[id2]>=21)
            id2++;
        if(W21[id2]+L21[id2]<21){
            if(s=='W')W21[id2]++;
            if(s=='L')L21[id2]++;
        }
    }
    for(int i=1;i<=id1;i++){
        cout<<W12[i]<<':'<<L12[i]<<endl;
    }
    cout<<endl;
    for(int i=1;i<=id2;i++){
        cout<<W21[i]<<':'<<L21[i]<<endl;
    }
    return 0;
}

by songyouyi @ 2024-08-04 20:01:42

11分制是指某一方分数大于等于11且超出对方2分才获胜,21分制是指某一方分数大于等于21且超出对方2分才获胜,不是总分相加是11或21


|