比赛 noip_6 评测结果 AWAWWW
题目名称 打保龄球 最终得分 33
用户昵称 maxiem 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-08 20:26:35
显示代码纯文本
program bowling;
var
  b:array [1..14,1..2] of integer;
  e:array [0..12] of integer;
  t,s:string;
  a,l,code,i,sp:integer;
  flag:boolean;
begin
  for i:=1 to 14 do begin
    b[i,1]:=-1;
    b[i,2]:=-1;
  end;
  fillchar (e,sizeof(e),0);
  assign (input,'bowling.in');
  reset (input);
  readln (s);
  close (input);
  assign (output,'bowling.out');
  rewrite (output);
  l:=0;s:=s+' ';
  while s<>'' do begin
    inc(l);sp:=pos(' ',s);
    t:=copy(s,1,sp-1);
    if length(t)=1 then begin
      b[l,1]:=10;b[l,2]:=0;
    end
    else begin
      val(copy(t,1,1),b[l,1],code);
      val(copy(t,2,2),b[l,2],code);
      if code<>0 then b[l,2]:=10-b[l,1];
    end;
    delete (s,1,sp);
  end;
  flag:=true;
  for i:=1 to l do begin
    inc(e[0]);
    if b[i,2]=0 then begin
      if i=12 then e[i]:=10 else begin
        if (b[i+1,1]=-1) or (b[i+1,2]=-1) then begin flag:=false;break; end;
        if b[i+1,2]=0 then e[i]:=10+b[i+1,1]+b[i+2,1] else e[i]:=10+b[i+1,1]+b[i+1,2];
      end;
    end
    else begin
      if b[i,1]+b[i,2]=10 then begin
        if i=12 then e[i]:=10 else begin
          if (b[i+1,1]=-1) then begin flag:=false;break end;
          e[i]:=b[i+1,1]+10;
        end;
      end
      else e[i]:=b[i,1]+b[i,2];
    end;
  end;
  if flag=false then dec(e[0]);write (e[1]);
  for i:=2 to e[0] do write (' ',e[i]);
  writeln;write (e[1]);a:=e[1];
  for i:=2 to e[0] do begin
    write (' ',a+e[i]);
    inc(a,e[i]);
  end;
  close (output);
end.