记录编号 |
19058 |
评测结果 |
AAAAAA |
题目名称 |
打保龄球 |
最终得分 |
100 |
用户昵称 |
gragon |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2010-09-28 12:00:48 |
内存使用 |
0.11 MiB |
显示代码纯文本
program ex;
var
a:array[1..14,1..2] of longint;
b:array[0..14,1..2] of longint;
s:string;
y,x,l,i,n:longint;
begin
assign(input,'bowling.in');
reset(input);
read(s);
close(input);
l:=length(s);
x:=1;
y:=1;
b[0,2]:=0;
for i:=1 to l do
begin
if (s[i]='/') then
a[x,y]:=10;
if (s[i]=' ') then
begin
inc(x);
y:=1;
end;
if (s[i]<>'/') and (s[i]<>' ') then
begin
val(s[i],a[x,y]);
inc(y);
end;
end;
for i:=1 to x do
begin
if (a[i,1]=10) then
if (a[i+1,1]=10) then
b[i,1]:=20+a[i+2,1];
if (a[i,1]=10) and (a[i+1,1]<>10) then
if (a[i+1,2]=10) then
b[i,1]:=20
else
b[i,1]:=10+a[i+1,1]+a[i+1,2];
if (a[i,1]<>10) then
if (a[i,2]<>10) then
b[i,1]:=a[i,1]+a[i,2]
else
b[i,1]:=10+a[i+1,1];
end;
for i:=1 to 10 do
b[i,2]:=b[i,1]+b[i-1,2];
assign(output,'bowling.out');
rewrite(output);
if (x<=10) then
begin
if (a[x,1]=10) and (a[x-1,1]=10) then
begin
for i:=1 to x-3 do
write(b[i,1],' ');
writeln(b[x-2,1]);
for i:=1 to x-3 do
write(b[i,2],' ');
writeln(b[x-2,2]);
end
else
begin
for i:=1 to x-2 do
write(b[i,1],' ');
writeln(b[x-1,1]);
for i:=1 to x-2 do
write(b[i,2],' ');
writeln(b[x-1,2]);
end;
end
else
begin
for i:=1 to 9 do
write(b[i,1],' ');
writeln(b[10,1]);
for i:=1 to 9 do
write(b[i,2],' ');
writeln(b[10,2]);
end;
close(output);
end.