记录编号 5518 评测结果 AAAAAA
题目名称 打保龄球 最终得分 100
用户昵称 Gravatar辨机ZN 是否通过 通过
代码语言 Pascal 运行时间 0.000 s
提交时间 2008-10-27 12:20:25 内存使用 0.12 MiB
显示代码纯文本
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]='/')and(s[l-1][2]<>'/') then l:=l-2
  else
    begin if (s[l-1]='/')and(s[l][2]='/') then l:=l-1
         else
          begin
         if (s[l-1][1]<>'/')and(s[l-1][2]='/') then l:=l-1
          else
         if a[l-1,0]=2 then
         if s[l-1][2]='/' then l:=l-1;
          end
    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.