比赛 noip_6 评测结果 AAAAWA
题目名称 打保龄球 最终得分 83
用户昵称 辨机ZN 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-26 10:57:28
显示代码纯文本
program ex(f1,f2);
 type
  zn=array [1..15] of string;
  ka=array [1..15,0..3] of integer;
  la=array [1..15] of integer;
 var
  s:zn; a:ka; c,ans:la;
  f1,f2:text; i,j,k,p,m,n,l,ll:integer;
  s1,s2,s3:string;
 begin
  assign(f1,'bowling.in'); reset(f1);
  assign(f2,'bowling.out'); rewrite(f2);
  readln(f1,s1);
  l:=1;
  for i:=1 to 15 do s[i]:='';
  for i:=1 to length(s1) do
   if s1[i]<>' ' then s[l]:=s[l]+s1[i]
                 else inc(l);
  for i:=1 to 15 do
   for j:=0 to 2 do a[i,j]:=0;
  for i:=1 to l do
   begin
    if s[i]='/' then begin a[i,0]:=1; a[i,1]:=10; end
     else if s[i][2]='/' then
            begin
             a[i,0]:=2;
             a[i,1]:=ord(s[i][1])-48;
             a[i,2]:=10-a[i,1];
            end
       else begin
             a[i,0]:=2;
             a[i,1]:=ord(s[i][1])-48;
             a[i,2]:=ord(s[i][2])-48;
            end;
   end;

  for i:=10 downto 1 do
   begin
    if a[i,1]=10 then p:=2
                 else if a[i,1]+a[i,2]=10 then p:=1
                  else p:=0;
    c[i]:=a[i,1]+a[i,2];
    if p=1 then c[i]:=c[i]+a[i+1,1];
    if p=2 then
     begin
      c[i]:=c[i]+a[i+1,1];
      if a[i+1,0]=1 then c[i]:=c[i]+a[i+2,1]
                    else c[i]:=c[i]+a[i+1,2];
     end;
   end;

 for i:=1 to 10 do ans[i]:=0;
 ans[1]:=c[1];
  if l>10 then l:=10 else
   begin
 if s[l-2]='/' then l:=l-2
  else
    begin if (s[l-1]='/')and(s[l][2]='/') then l:=l-1
         else
         if a[l-1,0]=2 then
         if s[l-1][2]='/' then l:=l-1;
    end;
   end;




 for i:=2 to l do ans[i]:=ans[i-1]+c[i];
 for i:=1 to l do write(f2,c[i],' ');
 writeln(f2);
 for i:=1 to l do write(f2,ans[i],' ');
 close(f1);
 close(f2);
 end.