比赛 noip_6 评测结果 WWAAWA
题目名称 打保龄球 最终得分 50
用户昵称 name:弓虽 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-26 11:55:10
显示代码纯文本
program bowling(input,output);
var
  a:array[1..12,1..2] of char;
  b,c:array[0..12] of longint;
  d,d0:char;
  l:longint;
  i,j:longint;

  function add(x,y:integer):integer;
  begin
    if a[x,y]='/' then add:=10;
    if a[x,y]=' ' then add:=0;
    if (a[x,y]<>'/')and(a[x,y]<>' ') then add:=ord(a[x,y])-ord('0');
  end;
begin
  assign(input,'bowling.in');
  reset(input);
  for i:=1 to 12 do begin
    for j:=1 to 2 do begin
      a[i,j]:=' ';
    end;
  end;
  while not(eof(input)) do begin
    read(d);
    read(d0);
    if (d=' ')and(d0<>' ') then begin
      inc(l); a[l,1]:=d0;
      read(d0); a[l,2]:=d0
    end;
    if (d<>' ')and(d0=' ') then begin
      inc(l); a[l,1]:=d;
    end;
    if (d<>' ')and(d0<>' ') then begin
      inc(l); a[l,1]:=d; a[l,2]:=d0;
    end;
  end;
  close(input);

  for i:=1 to 10 do begin
    if a[i,1]='/' then begin
      b[i]:=b[i]+10;
      if a[i+1,1]='/' then b[i]:=b[i]+10+add(i+2,1);
      if a[i+1,1]<>'/' then begin
        if a[i+1,2]<>'/' then b[i]:=b[i]+add(i+1,1)+add(i+1,2);
        if a[i+1,2]='/' then b[i]:=b[i]+10;
      end;
    end;
    if (a[i,1]<>'/')and(a[i,2]='/') then b[i]:=b[i]+10+add(i+1,1);
    if (a[i,1]<>'/')and(a[i,2]<>'/') then b[i]:=b[i]+add(i,1)+add(i,2);
  end;
  assign(output,'bowling.out');
  rewrite(output);
  for i:=1 to 10 do begin
    c[i]:=c[i-1]+c[i]+b[i];
    write(b[i],' ');
  end;
  writeln(output);
  for i:=1 to 10 do write(c[i],' ');
  close(output);
end.{...}