30分,求助

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-30 10:35:05


``` 11:3! 11:2! 11:2! 11:4! 11:9! 11:0! 11:7! 11:4! 11:9! 11:4! 11:3! 11:5! 11:8! 11:9! 11:6! 11:5! 11:8! 11:4! 11:3! 11:3! 11:4! 11:9! 11:1! 11:7! 11:6! 11:4! 11:3! 11:8! 12:10! 11:4 11:4 11:3 11:6 11:7 11:2 11:3 11:8 11:3 12:10 11:5 11:7 11:8 9:11 11:4 11:3 11:7 11:5 11:8 11:2 11:9 11:7 11:5 11:1 11:7 11:6 11:6 12:10 11:4 11:9 7:11 11:2 11:8 11:5 11:3 11:9 11:7 11:9 11:2 9:11 11:3 11:3 8:11 11:1 11:2 11:4 11:5 11:4 11:1 11:6 11:4 11:7 11:4 11:4 11:7 8:11 11:6 11:5 11:3 11:2 16:18 11:7 11:4 11:7 11:5 11:3 14:12 11:3 11:3 11:3 11:7 11:8 11:4 11:4 11:5 11:6 11:9 11:0 11:7 11:6 12:10 11:4 11:2 11:2 11:5 11:8 11:9 11:3 11:4 11:5 11:7 11:5 2:0 21:4 21:6 21:10 21:10 21:11 21:6 21:18 21:11 21:13 21:6 21:7 21:10 21:12 21:8 21:17 21:6 21:10 21:9 21:5 21:11 21:15 21:15 21:15 21:10 21:12 21:6 21:16 21:9 21:8 21:15 21:13 21:17 21:11 21:10 21:17 21:12 21:7 21:11 21:8 21:7 21:7 21:11 21:8 21:16 21:13 21:5 22:20 21:12 21:9 21:14 21:7 21:7 21:12 21:11 21:9 21:8 21:13 21:13 21:4 21:13 21:10 21:10 21:11 7:2 ``` 前面11分制的怎么还有12:10,这样例错没错啊
by shenyeting @ 2024-01-30 10:38:07


错没错
by shenyeting @ 2024-01-30 10:38:35


|