乒乓球

来源:互联网 发布:移动4g网络最近怎么了 编辑:程序博客网 时间:2024/05/16 01:20
var
 c:array[1..500001] of char;
 n,i,s1,s2:longint;
begin
 repeat
  inc(n);
  read(c[n]);
 until c[n]='E';
 for i:=1 to n do
  begin
   if c[i]='W' then inc(s1);
   if c[i]='L' then inc(s2);
   if (abs(s1-s2)>=2)and((s1>=11)or(s2>=11)) then
    begin writeln(s1,':',s2); s1:=0;s2:=0; end
   else if i=n then writeln(s1,':',s2);
  end;
 s1:=0;s2:=0;
 writeln;
 for i:=1 to n do
  begin
   if c[i]='W' then inc(s1);
   if c[i]='L' then inc(s2);
   if (abs(s1-s2)>=2)and((s1>=21)or(s2>=21)) then
    begin writeln(s1,':',s2); s1:=0;s2:=0; end
    else if i=n then writeln(s1,':',s2);
  end;
end.
0 0
原创粉丝点击