记录编号 |
5533 |
评测结果 |
AAAAAA |
题目名称 |
打保龄球 |
最终得分 |
100 |
用户昵称 |
zpl123 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.004 s |
提交时间 |
2008-10-27 13:26:25 |
内存使用 |
0.12 MiB |
显示代码纯文本
program bowling;
var
s:string;
l,k:longint;
data:array[1..12]of string;
out:array[1..10,1..2]of longint;
y:array[1..24]of longint;
procedure init;
var
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 10 do
if out[i,1]>=0 then
write(out[i,1],' ');
writeln;
for i:=1 to 10 do
if out[i,1]>=0 then
write(out[i,2],' ');
close(input);
close(output);
end;
begin
init;
main;
print;
end.