记录编号 18846 评测结果 TTTTTEAAWW
题目名称 [NOIP 2003]乒乓球 最终得分 20
用户昵称 Gravatargragon 是否通过 未通过
代码语言 Pascal 运行时间 5.048 s
提交时间 2010-09-21 08:29:50 内存使用 0.11 MiB
显示代码纯文本
program ex;
var
f:text;
m1,n1,x,y,i,n,m,j,k:integer;
s:char;
a:array[1..10,1..2] of integer;
b:array[1..10,1..2] of integer;
begin
assign(f,'table.in');
reset(f);
m:=0;
n:=0;
m1:=0;
n1:=0;
x:=0;
y:=0;

repeat
  begin
  read(f,s);
  if (s='W') then
  begin
  m:=m+1;
  m1:=m1+1;
  if (m>=11) and (m-2>=n) then
    begin
    inc(x);
    a[x,1]:=m;
    a[x,2]:=n;
    m:=0;
    n:=0;
    end;
  if (m1>=21) and (m1-2>=n) then
    begin
    inc(y);
    b[y,1]:=m1;
    b[y,2]:=n1;
    m1:=0;
    n1:=0;
    end;
  end;

  if (s='L') then
  begin
  n:=n+1;
  n1:=n1+1;
  if (n>=11) and (n-2>=m) then
    begin
    inc(x);
    a[x,1]:=m;
    a[x,2]:=n;
    m:=0;
    n:=0;
    end;
  if (n1>=21) and (n1-2>=m) then
    begin
    inc(y);
    b[y,1]:=m1;
    b[y,2]:=n1;
    m1:=0;
    n1:=0;
    end;
  end;
  if (s='E') then
    begin
    inc(x);
    a[x,1]:=m;
    a[x,2]:=n;
    inc(y);
    b[y,1]:=m1;
    b[y,2]:=n1;
    break;
    end;
  end
until eof(f);
close(f);
assign(f,'table.out');
rewrite(f);
for i:=1 to x do
begin
if (a[i,1]=0) and (a[i,2]=0) then
break;
writeln(f,a[i,1],':',a[i,2]);
end;
writeln(f);
for i:=1 to y do
begin
if (b[i,1]=0) and (b[i,2]=0) then
break;
writeln(f,b[i,1],':',b[i,2]);
end;
close(f);
end.