记录编号 |
5683 |
评测结果 |
AAAAAA |
题目名称 |
打保龄球 |
最终得分 |
100 |
用户昵称 |
bing |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.018 s |
提交时间 |
2008-10-27 21:13:16 |
内存使用 |
0.11 MiB |
显示代码纯文本
program bing;
var
f1,f2:text;
s:string;
a:array[1..15,1..3] of integer;
b:array[1..15] of integer;
c:array[0..15] of integer;
i,j:integer;
procedure init;
var
i:integer;
begin
assign(f1,'bowling.in');reset(F1);
assign(f2,'bowling.out');rewrite(F2);
readln(f1,s);
i:=0;j:=0;
fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
repeat
inc(j);
if s[1]='/' then begin a[j,1]:=10;delete(s,1,2);a[j,3]:=a[j,1];end
else begin a[j,1]:=ord(s[1])-ord('0');
if length(s)>=2 then
begin
if s[2]='/' then a[j,2]:=10-a[j,1] else a[j,2]:=ord(s[2])-ord('0');
end;
delete(s,1,3);
a[j,3]:=a[j,1]+a[j,2];
end
until s='';
if (a[j-1,1]=10) and (a[j-2,1]=10) then j:=j-2
else if (a[j-1,3]=10) then j:=j-1;
end;
procedure nb;
var
i:integer;
begin
for i:=1 to j do
begin
if (a[i,3]<>10) then b[i]:=b[i]+a[i,1]+a[i,2]
else begin
b[i]:=b[i]+a[i,1]+a[i,2]+a[i+1,1];
if a[i,2]=0 then
begin
b[i]:=b[i]+a[i+1,2];
if (a[i+1,3]=10)and(a[i+1,2]=0) then b[i]:=b[i]+a[i+2,1];end;
end;end;
for i:=1 to j do
c[i]:=c[i-1]+b[i];
end;
begin
init;
nb;
for i:=1 to j do write(f2,b[i],' ');
writeln(f2);
for i:=1 to j do write(f2,c[i],' ');
close(F1);close(F2);
end.