求助!!!!!本地正确,提交WA!目前只有#1和#10通过!!!

P1042 [NOIP2003 普及组] 乒乓球

用这个试试 ```cpp #include<bits/stdc++.h> using namespace std; char c[62530]; int n,m; int main(){ for(int i=0;c[i-1]!='E';++i) scanf("%c",&c[i]); for(int i=0;c[i]!='E';++i){ if(c[i]=='W') ++n; else if(c[i]=='L') ++m; if( (n>=11 && n-m>=2) || (m>=11 && m-n>=2) ){ cout<<n<<':'<<m<<endl; n=0; m=0; } } cout<<n<<':'<<m; cout<<endl<<endl; n=0; m=0; for(int i=0;c[i]!='E';++i){ if(c[i]=='W') ++n; else if(c[i]=='L') ++m; if( (n>=21 && n-m>=2) || (m>=21 && m-n>=2) ){ cout<<n<<':'<<m<<endl; n=0; m=0; } } cout<<n<<':'<<m; return 0; } ```
by Liu_Zi_Xiao @ 2024-04-16 13:26:12


|