比赛 noip_6 评测结果 WWAAWA
题目名称 打保龄球 最终得分 50
用户昵称 zpl123 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-26 11:11:50
显示代码纯文本
program bowling;
var
s:string;
l:longint;
data:array[1..12]of string;
out:array[1..10,1..2]of longint;
y:array[1..24]of longint;

procedure init;
var
k,l:longint;

begin
assign(input,'bowling.in');
reset(input);
assign(output,'bowling.out');
rewrite(output);
readln(s);
l:=length(s);
k:=1;
while l>0 do
begin
if s[1]='/' then
  begin
  data[k]:='/ ';
  delete(s,1,2);
  inc(k);
  l:=l-2;
  end else
if (s[1] in ['0'..'9']) then
  begin
  data[k]:=copy(s,1,2);
  delete(s,1,3);
  inc(k);
  l:=l-3;
  end;
end;
end;

procedure main;
var
i,k,tot:longint;
begin
k:=1;
for i:=1 to 12 do
 begin
 if data[i]='/ ' then begin y[k]:=10;  inc(k,1);  end;
 if data[i][2]='/' then begin y[k]:=ord(data[i][1])-ord('0'); y[k+1]:=10-y[k]; k:=k+2 end;
 if (data[i][1]<>'/')and(data[i][2]<>'/') then begin y[k]:=ord(data[i][1])-ord('0'); y[k+1]:=ord(data[i][2])-ord('0'); k:=k+2; end;
 end;
k:=1;
for i:=1 to 10 do
 begin
 if data[i]='/ ' then begin out[i,1]:=10+y[k+1]+y[k+2]; k:=k+1; end;
 if data[i][2]='/' then begin out[i,1]:=10+y[k+2]; k:=k+2 end;
 if (data[i][1]<>'/')and(data[i][2]<>'/') then begin out[i,1]:=ord(data[i][1])-ord('0')+ord(data[i][2])-ord('0'); k:=k+2 end;
 end;

tot:=0;
for i:=1 to 10 do begin  tot:=tot+out[i,1]; out[i,2]:=tot; end;

end;


procedure print;
var
i:longint;
begin
 for i:=1 to 9 do write(out[i,1],' ');
 writeln(out[10,1]);
 for i:=1 to 9 do write(out[i,2],' ');
 writeln(out[10,2]);
close(input);
close(output);
end;


begin
init;
main;
print;
end.