求救,60分

P1042 [NOIP2003 普及组] 乒乓球

chenziyv123 @ 2024-10-21 20:43:07

#include <bits/stdc++.h>
using namespace std;
char a;
char b[1000000];
int ww,ll;
int main()
{
    int cnt=0;
    while(cin>>a)
    {   
         cnt++;
        b[cnt]=a;
        if(a=='E')
        {
            cout<<ww<<":"<<ll<<endl<<endl;
            break;
        }
        if(a=='W')
        {
            ww++;
        }
        else
        {
            ll++;
        }
        if((ll==11||ww==11)&&abs(ll-ww)>=2)
        {
            cout<<ww<<":"<<ll<<endl;
            ll=0,ww=0;
        }

    }
    ll=0,ww=0;
    for(int i=1;i<=cnt;i++)
    {
        if(b[i]=='E')
        {
            cout<<ww<<":"<<ll<<endl<<endl;
        }
        if(b[i]=='W')
        {
            ww++;
        }
        else
        {
            ll++;
        }
        if((ll==21||ww==21)&&abs(ll-ww)>=2)
        {
            cout<<ww<<":"<<ll<<endl;
            ll=0,ww=0;
        }
    }
    return 0;
}

by sty_qianhaoyan @ 2024-10-21 20:56:27

哪一题啊


by Steve_60505 @ 2024-10-21 21:00:35

@chenziyv123 哪题呀?你倒是说呀!


by Steve_60505 @ 2024-10-21 21:03:21

哦,看见了。当我没说。


by _Vistion_ @ 2024-10-21 21:06:27

@Steve_60505 @sty_qianhaoyan 乐


by Steve_60505 @ 2024-10-21 21:14:16

@chenziyv123 好像没啥问题呀……


by Steve_60505 @ 2024-10-21 21:16:35

@Vistion ……


by Steve_60505 @ 2024-10-21 21:17:39

@Vistion 你看出问题了吗???


by _Vistion_ @ 2024-10-21 21:20:22

@Steve_60505 题目都不知道在哪儿 好好练练吧


by Steve_60505 @ 2024-10-21 21:21:31

@Vistion 我才第一次进讨论区……


by chenziyv123 @ 2024-10-21 21:22:01

我WA了四个点


| 下一页