30分,求调!

P1042 [NOIP2003 普及组] 乒乓球

luog_u @ 2024-07-02 23:33:06

测试点信息

AC

1

Accepted, 得分 10.ok accepted

WA

2

WA

3

0ms/0B RE

4

0ms/0B RE

5

Runtime Error.

0ms/0B RE

6

Runtime Error.

0ms/0B RE

7

Runtime Error.

AC

8

Accepted, 得分 10.ok accepted

WA

9

AC

10

Accepted, 得分 10.ok accepted

#include<bits/stdc++.h>
using namespace std;
char s[2005];
int i=1,h=0,d=0,a[2005],k=0,l=0;
int main() {
    while(1){
        cin>>s[i];
        if(s[i]=='E') break;
        if(s[i]=='W') h++;
        if(s[i]=='L') d++;
        if(i%11==0){
            cout<<h<<":"<<d<<endl;
            h=0,d=0;
        }
        i++;
    }
    cout<<h<<":"<<d<<endl<<endl;
    for(int j=1;j<=i;j++){
        if(s[j]=='E') break;
        if(s[j]=='W') k++;
        if(s[j]=='L') l++;
        if(j%21==0){
            cout<<k<<":"<<l<<endl;
            k=0,l=0;
        }
    }
    cout<<k<<":"<<l;
    return 0;
}

求dalao们看看蒟蒻哪里错了!


by Sheep_YCH @ 2024-07-03 05:57:17

1.你好像没有没有特判“直到分差大于或者等于 2,才一局结束。”

2.数据范围最多有25*2500 = 62500个,数组开2005不够用


|