记录编号 |
19066 |
评测结果 |
AAAAWW |
题目名称 |
打保龄球 |
最终得分 |
66 |
用户昵称 |
1102 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.000 s |
提交时间 |
2010-09-28 13:28:03 |
内存使用 |
0.11 MiB |
显示代码纯文本
program xxxxx;
var a:array[1..120,1..2] of integer;
b,w:array[1..100] of integer;
chr:char;
x,y,i,l:integer;
begin
assign(input,'bowling.in');
reset(input);
assign(output,'bowling.out');
rewrite(output);
x:=1;
y:=1;
for i:=1 to 12 do
begin
a[i,1]:=-1;
a[i,2]:=-1;
end;
repeat
begin
read(chr);
if (chr<>' ') then
begin
if (chr='/') then
begin
a[x,2]:=10;
inc(x);
y:=1;
end
else
begin
if y=1 then
begin
val(chr,a[x,y]);
y:=2;
end
else
begin
val(chr,a[x,y]);
y:=1;
end;
if y=1 then
inc(x);
end;
end;
end
until eof(input);
dec(x);
l:=x;
if (a[x-1,2]=10) then
begin
l:=x-1;
if (a[x-1,1]=-1)and(a[x-2,1]=-1) then
l:=l-1;
end;
//if (a[x-1,2]=10)and(a[x,1]<>-1) then
//l:=x-1;
for i:=1 to l do
begin
if a[i,1]=-1 then
begin
b[i]:=10;
if a[i+1,1]<>-1 then
begin
if a[i+1,2]=10 then
b[i]:=b[i]+a[i+1,2];
if a[i+1,2]<>10 then
b[i]:=b[i]+a[i+1,1]+a[i+1,2];
end;
if a[i+1,1]=-1 then
if a[i+2,1]=-1 then
b[i]:=30
else
b[i]:=20+a[i+2,1];
end;
if (a[i,1]<>-1)and(a[i,2]=10) then
if a[i+1,1]<>-1 then
b[i]:=a[i,2]+a[i+1,1]
else
b[i]:=a[i,2]+a[i+1,2];
if (a[i,1]<>-1)and(a[i,2]<>10) then
b[i]:=a[i,1]+a[i,2];
end;
for i:=1 to l-1 do
write(b[i],' ');
writeln(b[l]);
x:=0;
for i:=1 to l do
begin
x:=x+b[i];
write(x,' ');
end;
close(input);
close(output);
end.