mab123456 @ 2024-07-19 18:00:07
#include<bits/stdc++.h>
using namespace std;
char s[63500];
int l,w,t1,t2,t,len;
int main()
{
for(int i=1;;i++)
{
cin>>s[i];
if(s[i]=='E')
{
len=i;break;
}
}
t1=len/11;
t2=len/21;
for(int i=0;i<len;i++)
{
if(w+l==11&&t<=t1)
{
cout<<w<<":"<<l<<endl;
w=l=0;
t++;
}
if(s[i]=='W')
w++;
if(s[i]=='L')
l++;
}
if(w!=0||l!=0||(w!=0&&l!=0))
{
cout<<w<<":"<<l<<endl;
w=l=0;
}
cout<<endl;
for(int i=0;i<len;i++)
{
if(w+l==21&&t<=t1)
{
cout<<w<<":"<<l<<endl;
w=l=0;
t++;
}
if(s[i]=='W')
w++;
if(s[i]=='L')
l++;
}
if(w!=0||l!=0||(w!=0&&l!=0))
{
cout<<w<<":"<<l<<endl;
w=l=0;
}
return 0;
}
by lty2023 @ 2024-07-19 18:07:16
#include<bits/stdc++.h>
using namespace std;
int main(){
char a3;
string a="";
int a1,a2;
cin>>a;
a1=0;
a2=0;
for(;;){
cin>>a3;
if(a3=='E'){
break;
}
a+=a3;
}
for(int i=0;i<a.size();i++){
if(a[i]=='W'){
a1++;
}
else{
a2++;
}
if((a1>=11||a2>=11)&&abs(a1-a2)>1){
cout<<a1<<":"<<a2<<endl;
a1=0;
a2=0;
}
}
cout<<a1<<":"<<a2<<"\n\n";
a1=0;
a2=0;
for(int i=0;i<a.size();i++){
if(a[i]=='W'){
a1++;
}
else{
a2++;
}
if((a1>=21||a2>=21)&&abs(a1-a2)>1){
cout<<a1<<":"<<a2<<endl;
a1=0;
a2=0;
}
}
cout<<a1<<":"<<a2;
}
虽然没过,但也80分了