90PTS求助

P1042 [NOIP2003 普及组] 乒乓球

zhengyi0402 @ 2024-10-03 17:46:44

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    char c;
    int o = 0;
    string s = "";
    while(cin>>c){
        if(c=='E')break;
        if(c=='W'||c=='L')s+=c;
    }
    int w,l;
    w=l=0;
    int sum = 0;
    if(s.size()==0){
        cout<<"0:0\n\n0:0";
    }
    for(int i = 0;i < s.size();i++){
        sum++;
        if(max(w,l)>=11&&max(w,l)-min(w,l)>=2){
            cout<<w<<':'<<l<<endl;
            w=l=0;
        }
        if(s[i]=='W')w++;
        if(s[i]=='L')l++;
    }
    if(w==0&&l==0){
        cout<<endl;
    }else{
        cout<<w<<':'<<l<<endl<<endl;
    }
    w=l=0;
    for(int i = 0;i < s.size();i++){
        if(max(w,l)>=21&&max(w,l)-min(w,l)>=2){
            cout<<w<<':'<<l<<endl;
            w=l=0;
        }
        if(s[i]=='W')w++;
        if(s[i]=='L')l++;
    }
    if(w==0&&l==0){
        cout<<endl;
    }else{
        cout<<w<<':'<<l<<endl<<endl;
    }
    return 0;
    //十年OI一场空,define int 见祖宗。
    //十年OI一场空,不开long long见祖宗。
}

一直显示最后一个点“Too short on line 2",但我的下数据机会用完了ToT


by Alvin0228 @ 2024-10-03 17:55:18

下过来了 input:

WWWWWWWWWWWEadfadf;jadf

output:

11:0
0:0

11:0

by zhengyi0402 @ 2024-10-03 20:12:49

@Alvin0228 Thanks!!!


|