Fish_redflying @ 2024-05-02 17:59:25
在编辑器上测对,在luogu
#include<bits/stdc++.h>
using namespace std;
char str[5000000];
int len,w,l;
void show(int lun,int start) {
w=0,l=0;
//cout<<lun<<endl;
for(;start<len;start++) {
if (str[start]=='\n') continue;
if (abs(w-l)>=2 && (w>=lun || l>=lun)) break;
if (str[start]=='W') w++; else l++;
}
printf("%d:%d\n",w,l);
if (start==len) return; else show(lun,start);
}
int main()
{
scanf("%[^E]",str);
len=strlen(str);
show(11,0);
printf("\n");
show(21,0);
}
求解QWQ
by tzzl3035 @ 2024-05-02 19:36:44
哪道题?
by tzzl3035 @ 2024-05-02 19:37:22
@tzzl3035 没注意到旁边
by aleavf @ 2024-05-23 18:06:32
@fishredflying
#include<bits/stdc++.h>
using namespace std;
long long c[100000],d[100000];
int main(){
char x;
long long y=0,o=0,a=0,b=0;
while(x!='E'){
cin>>x;
if(x=='W'){
c[o]++;
a++;
}
if(x=='L'){
b++;
d[o]++;
}
if(x=='E'){
cout<<a<<':'<<b<<endl;
break;
}
if((a>=11||b>=11)&&(a-b>=2||b-a>=2)){
cout<<a<<':'<<b<<endl;
a=0;b=0;
}
if((c[o]>=21||d[o]>=21)&&(c[o]-d[o]>=2||d[o]-c[o]>=2)){
o++;
}
}
cout<<endl;
for(int i=0;i<=o;i++){
cout<<c[i]<<':'<<d[i]<<endl;
}
}
AC代码,求关0.0