CSP400pts @ 2024-08-28 21:52:44
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e6+5;
char ch;
char s[N];
int cnt,tmp1,tmp2;
int main() {
while(cin>>ch&&ch!='E') {
cnt++;
s[cnt]=ch;
}
if(cnt==0) {
cout<<"0:0"<<endl<<endl<<"0:0";
return 0;
}
for(int i=1; i<=cnt; i++) {
if(s[i]=='W') tmp1++;
if(s[i]=='L') tmp2++;
if(tmp1>=11&&tmp1-tmp2>=2) {
cout<<tmp1<<":"<<tmp2<<endl;
tmp1=0;
tmp2=0;
}
if(tmp2>=11&&tmp2-tmp1>=2) {
cout<<tmp1<<":"<<tmp2<<endl;
tmp1=0;
tmp2=0;
}
}
if(tmp1||tmp2) cout<<tmp1<<":"<<tmp2<<endl;
tmp1=0;
tmp2=0;
for(int i=1; i<=cnt; i++) {
if(s[i]=='W') tmp1++;
if(s[i]=='L') tmp2++;
if(tmp1>=21&&(tmp1-tmp2)>=2) {
cout<<tmp1<<":"<<tmp2<<endl;
tmp1=0;
tmp2=0;
}
if(tmp2>=21&&(tmp2-tmp1)>=2) {
cout<<tmp1<<":"<<tmp2<<endl;
tmp1=0;
tmp2=0;
}
}
if(tmp1||tmp2) cout<<tmp1<<":"<<tmp2;
return 0;
return 0;
}
by manis @ 2024-08-31 15:13:59
@CSP400pts 样例:
11:0
11:0
1:1
21:0
2:1
(请问一下你的空行去哪了)