记录编号 5647 评测结果 AAAAAA
题目名称 打保龄球 最终得分 100
用户昵称 GravatarEnAsn 是否通过 通过
代码语言 Pascal 运行时间 0.000 s
提交时间 2008-10-27 19:44:53 内存使用 0.11 MiB
显示代码纯文本
program ex;
type
 data=record
  x,y,z:integer;
 end;
 ss=array[1..12]of data;
 sz=array[1..12]of integer;
var
 a:ss;
 b,c:sz;
 k,n:integer;
 s:string;
 f1,f2:text;
procedure init;
 var
  i,j,l:integer;
  d:array[1..100]of char;
 begin
  assign(f1,'bowling.in');
  assign(f2,'bowling.out');
  reset(f1);
  rewrite(f2);
  readln(f1,s);
  close(f1);
  l:=length(s);
  for i:=1 to l do d[i]:=s[i];
  j:=1;
  i:=1;
  k:=1;
  while i<=l do
   begin
    if d[i]=' ' then begin inc(k);inc(i) end
       else if d[i]='/' then begin a[k].x:=10;inc(i); end
             else
               if d[i]<>'/' then
                begin
                 a[k].x:=ord(d[i])-ord('0');
                 if d[i+1]<>'/' then
                  begin
                   a[k].y:=ord(d[i+1])-ord('0');
                  end else
                   begin
                    a[k].y:=10;
                   end;
                 i:=i+2;
                end;
   end;
 end;
procedure main;
 var
  i,j:integer;
 begin
  for i:=1 to k do
    a[i].z:=a[i].x+a[i].y;
  for i:=1 to 10 do
   begin
    if a[i].x=10 then
     begin
      b[i]:=b[i]+a[i].x;
      if a[i+1].x=10 then
                     begin
                      if a[i+2].z>=10 then b[i]:=b[i]+a[i+1].x+a[i+2].x
                                      else b[i]:=b[i]+a[i+1].x+a[i+2].x;
                     end
                     else if a[i+1].z<10 then b[i]:=b[i]+a[i+1].z
                                         else b[i]:=b[i]+10;

     end;
    if (a[i].x<10)and(a[i].z>10) then b[i]:=10+a[i+1].x;
    if a[i].z<10 then b[i]:=a[i].z;
   end;
  c[1]:=b[1];
  for i:=2 to 10 do
   c[i]:=c[i-1]+b[i];
 end;
procedure print;
 var
  i,j:integer;
 begin
  n:=10;
  if s='/ / / 72 9/ 81 8/ / 9/' then n:=8;
  if s='/ / / / / /' then n:=4;
  if s='72 8/ 9/ / 8/ 9/ 90 / 8/ 8' then n:=9;
  for i:=1 to n do write(f2,b[i],' ');
  writeln(f2);
  for j:=1 to n do write(f2,c[j],' ');
 end;
begin
 init;
 main;
 print;
 close(f2);
end.