讨论 / c++代码
沧海一声喵 2018-02-27 10:30:57
点我顶贴 收藏 删除
#include <cstdio>

#include <cmath>

using namespace std;

int main(){

int i,len,k,n1,n2,h,flag;

char c,s[60000];

scanf("%c",&c);

for(len=0;c!='E';){

if(c=='W'||c=='L') s[++len]=c;

scanf("%c",&c);}

if(!len){

printf("%d:%d\n",0,0);

putchar('\n');

printf("%d:%d",0,0);}

else{

for(h=11;h<=21;h+=10){

flag=0;

for(k=1;k<=len;){

n1=n2=0;

for(;n1<h&&n2<h&&k<=len;k++){

if(s[k]=='W') n1++;

if(s[k]=='L') n2++;}

if((n1==h&&n2<h-1&&k>len)||(n1<h-1&&n2==h&&k>len)) flag=1;

if(abs(n1-n2)<2){

for(;abs(n1-n2)<2&&k<=len;k++){

if(s[k]=='W') n1++;

if(s[k]=='L') n2++;}

if(abs(n1-n2)==2&&k>len) flag=1;}

printf("%d:%d\n",n1,n2);}

if(flag) printf("%d:%d\n",0,0);

putchar('\n');}}

return 0;}

查看更多回复
提交回复