记录编号 5603 评测结果 AAAAAA
题目名称 打保龄球 最终得分 100
用户昵称 Gravatar打不死的羊 是否通过 通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2008-10-27 18:56:40 内存使用 0.11 MiB
显示代码纯文本
program bowling;
Type
fxz1=array[1..20,1..2] of integer;
fxz2=array[1..20] of integer;
var
f1,f2:text;
a:fxz1;
ans1,ans2:fxz2;
p,step,l,i,j,k,m:integer;
s,ls:string;
f:boolean;
procedure zh(ls:string;i:integer);
var
j,x,code:integer;
begin
if length(ls)=1 then if ls='/'then a[i,1]:=10
                              else val(ls,a[i,1],code)
                else for j:=1 to 2 do
                     if ls[2]='/' then begin val(ls[1],a[i,1],code);
                                             a[i,2]:=10;
                                       end
                                  else begin val(ls,x,code);
                                             a[i,2]:=x mod 10;
                                             a[i,1]:=x div 10;
                                       end;
end;




begin
assign(f1,'bowling.in');
assign(f2,'bowling.out');
reset(f1);rewrite(f2);
readln(f1,s);
for i:=1 to 20 do
begin a[i,1]:=-1;a[i,2]:=-1;end;
i:=0;
{..................................................}
repeat
inc(i);
m:=pos(' ',s);
if m<>0 then begin ls:=copy(s,1,m-1);
                   delete(s,1,m);
                   zh(ls,i);
              end
        else begin zh(s,i);
                   delete(s,1,m);
             end;
until m=0;
l:=i;p:=2;
for i:=1 to l-1 do
begin
ans1[i]:=0;ans2[i]:=0;
f:=true;
step:=0;j:=i;
 while (step<3)and(f) do
 begin
 if a[j,1]=10 then begin ans1[i]:=ans1[i]+10;inc(step);end
              else begin if a[j,1]>=0 then begin ans1[i]:=ans1[i]+a[j,1];inc(step);end;
                         if step<3 then
                         begin
                         if a[j,2]=10 then ans1[i]:=ans1[i]-a[j,1]+10
                                      else if a[j,2]>=0 then ans1[i]:=ans1[i]+a[j,2];
                         inc(step);
                         end;
                   end;
 if (step=2)and(ans1[i]<10) then f:=false;
 if (step=3)and(j=l)and(i=l-1) then p:=1;
 inc(j);
 end;
end;
{..................................................}
if (a[l,1]=0)and(a[l,2]=-1)and(a[l-1,1]=10) then p:=2;
ans2[1]:=ans1[1];
for i:=2 to l-1 do
ans2[i]:=ans1[i]+ans2[i-1];
for i:=1 to l-p do
write(f2,ans1[i],' ');
writeln(f2);
for i:=1 to l-p do
write(f2,ans2[i],' ');
close(f1);close(f2);
end.