40分 求助大佬

P1042 [NOIP2003 普及组] 乒乓球

AC ```c #include<bits/stdc++.h> using namespace std; char str[100010]; int cnt=0; void show(int n){ int a=0,b=0; for(int i=0;i<cnt;i++){ if(str[i]=='W') a++; if(str[i]=='L') b++; if((a>=n||b>=n)&&abs(a-b)>=2){ cout<<a<<":"<<b<<endl; a=b=0; } } cout<<a<<":"<<b<<endl; } int main(){ char ch; while(cin>>ch&&ch!='E'){ if(ch=='W'||ch=='L'){ str[cnt++]=ch; } } show(11); cout<<endl; show(21); } ```
by timmyliao @ 2024-01-31 08:08:07


@[timmyliao](/user/1095093) 非常感谢, 请问佬, 我源代码是哪块地方出问题了, 我对比了下,还是水平不够, 没找出来(悲
by fang_tech @ 2024-02-01 13:48:34


|