比赛 |
noip_6 |
评测结果 |
WWAAWA |
题目名称 |
打保龄球 |
最终得分 |
50 |
用户昵称 |
elysian |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-10-08 21:32:11 |
显示代码纯文本
program elysian;
const
fin='bowling.in';fout='bowling.out';
var
a:array[1..12,1..2] of longint;
sc:array[1..12] of longint;
all:array[0..12] of longint;
f1,f2:text;
procedure init;
var
i,k:integer;
tmp:char;
begin
assign(f1,fin);reset(f1);
i:=1;
repeat
read(f1,tmp);
if tmp<>' ' then
begin
if tmp<>'/' then
begin
a[i,1]:=ord(tmp)-48;
read(f1,tmp);
if tmp<>'/' then begin a[i,2]:=ord(tmp)-48;sc[i]:=a[i,1]+a[i,2];end
else a[i,2]:=10;
end
else
begin
a[i,1]:=10;
end;
inc(i);
end;
until i>=12;
close(f1);
end;
procedure main;
var
i,j:longint;
begin
for i:=1 to 10 do
if sc[i]=0 then
begin
if a[i,1]=10 then
begin
if (a[i+1,1]=10)and(a[i+2,1]=10) then sc[i]:=30;
if (a[i+1,1]=10)and(a[i+2,1]<>10) then sc[i]:=20+a[i+2,1];
if (a[i+1,1]<>10)and(a[i+1,2]=10) then sc[i]:=20;
if (a[i+1,1]<>10)and(a[i+1,2]<>10) then sc[i]:=10+sc[i+1];
end;
if a[i,1]<>10 then
begin
if (a[i,2]=10)and(a[i+1,1]=10) then sc[i]:=20;
if (a[i,2]=10)and(a[i+1,1]<>10) then sc[i]:=10+a[i+1,1];
end;
end;
end;
procedure print;
var i:integer;
begin
assign(f2,fout);rewrite(f2);
for i:=1 to 9 do
begin
write(f2,sc[i],' ');
all[i]:=all[i-1]+sc[i];
end;
writeln(f2,sc[10]);
all[10]:=all[9]+sc[10];
for i:=1 to 9 do write(f2,all[i],' ');
write(f2,all[10]);
close(f2);
end;
begin
init;
main;
print;
end.