找壶盖子请私信
话不多说,切入正题P1042求调!
各路大佬放过我这个蓝名蒟蒻
已经卡了好一会了,快崩了
#include<bits/stdc++.h>
using namespace std;
string s;
char c;
bool f=false;
int a,x;
int main(){
while(cin>>c){
if(c=='E') f=true;
if(!f) s.push_back(c);
}
if(s.size()<11){
int t=s.size();
int tx=0;
int ty=0;
while(t--){
if(s[t]=='W') tx++;
else ty++;
}
cout<<tx<<':'<<ty<<endl;
}
else{
for(a=0;a<s.size();a+=11){
int tx=0;
int ty=0;
for(int i=0;i<11;i++){
if(a+i>=s.size()) break;
if(s[a+i]=='W') tx++;
else ty++;
}
while(abs(tx-ty)<2){
a++;
if(s[a+11]=='W') tx++;
else ty++;
}
cout<<tx<<':'<<ty<<endl;
}
}
cout<<endl;
if(s.size()<21){
int t=s.size();
int tx=0;
int ty=0;
while(t--){
if(s[t]=='W') tx++;
else ty++;
}
cout<<tx<<':'<<ty<<endl;
}
else{
for(a=0;a<s.size();a+=21){
int tx=0;
int ty=0;
for(int i=0;i<21;i++){
if(a+i>=s.size()) break;
if(s[a+i]=='W') tx++;
else ty++;
}
while(abs(tx-ty)<2){
a++;
if(s[a+21]=='W') tx++;
else ty++;
}
cout<<tx<<':'<<ty<<endl;
}
}
return 0;
}
(蒟蒻此处表示不知道错哪了)
谢谢!