比赛 noip_6 评测结果 AAAAAA
题目名称 打保龄球 最终得分 100
用户昵称 dingding 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-08 19:46:34
显示代码纯文本
program sda;
var
   e,f:text;
   i,j,k:integer;
   st:string;
   a:array[1..50,1..2]of integer;
   data:array[1..12]of longint;
procedure chushi;
begin
   for i:=1 to 50  do
   for j:=1 to 2 do
   a[i,j]:=-100;
   j:=1;
   k:=1;
   for i:=1 to length(st) do begin
   if st[i]=' ' then begin
   inc(j);
   k:=1;
   end;
   if (st[i]='/') and (k=1) then a[j,1]:=10;
   if (st[i]='/') and (k=2) then a[j,2]:=10-a[j,1];
   if (st[i]<='9') and (st[i]>='0') then begin
   a[j,k]:=ord(st[i])-48;
   inc(k);
   end;
   end;
end;
   begin
   assign(f,'bowling.in'); assign(e,'bowling.out');
   reset(f); rewrite(e);
   readln(f,st);
   close(f);
   chushi;
   for i:=1 to j do begin
   if (a[i,1]=10) and (a[i+1,1]=10) then data[i]:=20+a[i+2,1];
   if (a[i,1]=10) and (a[i+1,1]<>10) then data[i]:=10+a[i+1,1]+a[i+1,2];
   if (a[i,1]<>10) and (a[i,2]+a[i,1]=10) then data[i]:=10+a[i+1,1];
   if (a[i,1]<>10) and (a[i,2]+a[i,1]<>10) then data[i]:=a[i,1]+a[i,2];
   end;
   write(e,data[1]);
   for i:=2 to j do
   if data[i]>0 then write(e,' ',data[i])
   else break;
   writeln(e);
   write(e,data[1]);
   for i:=2 to j do
   if data[i]>0 then begin
   inc(data[i],data[i-1]);
   write(e,' ',data[i]);
   end
   else begin close(e); halt; end;
   close(e);
end.