FanZhiyu1 @ 2024-07-24 06:58:45
蒟蒻求助!!!只有50分[内牛满面]
#include<bits/stdc++.h>
using namespace std;
string s;
const int N=2501*30;
char tmp[N];
int a[N],b[N];
void work(int n,int cnt,int len){
int sa=0,sb=0;
while(cnt<len){
for(int i=cnt;i<cnt+n;i++){
sa+=a[i];sb+=b[i];
}
while(sa>=n||sb>=n){
if(abs(sa-sb)>=2){
cout<<sa<<":"<<sb<<endl;
}
sa=0;sb=0;
}
cnt+=n;
}
cout<<sa<<":"<<sb<<endl;
}
int main()
{
int i=0;
while(cin>>tmp[i]&&tmp[i]!='E')
s+=tmp[i],i++;
int len=s.length();
for(int i=0;i<len;i++){
if(s[i]=='W') a[i]++;
else b[i]++;
}
int cnt=0;
work(11,cnt,len);
cout<<endl;
cnt=0;
work(21,cnt,len);
return 0;
}
希望各位神犇指正!