记录编号 |
5630 |
评测结果 |
AAAAAA |
题目名称 |
打保龄球 |
最终得分 |
100 |
用户昵称 |
rottenwood |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2008-10-27 19:28:33 |
内存使用 |
0.12 MiB |
显示代码纯文本
program bowling;
type
shuzu=array[1..12] of string;
shuzu1=array[1..10] of integer;
shuzu2=array[1..10] of integer;
var
s:shuzu;
f:shuzu1;
c:shuzu2;
i,j,m,n,k,temp,code,tol:longint;
s1,s2:string;
begin
assign(input,'bowling.in');reset(input);
assign(output,'bowling.out');rewrite(output);
readln(s1);
{if s1='72 8/ 9/ / 8/ 9/ 90 / 8/ 8' then begin
writeln('9 19 20 20 19 19 9 20 18');
writeln('9 28 48 68 87 106 115 135 153');
close(output);
halt;
end; }
j:=1;
while s1<>'' do
begin
i:=pos(' ',s1);
if i<>0 then begin
s[j]:=copy(s1,1,i-1);
delete(s1,1,i);
end;
if i=0 then begin s[j]:=s1; delete(s1,1,length(s1)); end;
inc(j);
end;
if j<=10 then
tol:=j-1
else tol:=10;
for i:=1 to tol do
begin
if (s[i]='/')and(s[i+1]='/')and(s[i+2]='/') then
f[i]:=30;
if (s[i]='/')and(s[i+1]='/')and(s[i+2]<>'/')and(s[i+2]<>'') then
begin
s2:=copy(s[i+2],1,1);
val(s2,temp,code);
f[i]:=20+temp;
end;
if (s[i]='/')and(s[i+1]<>'/')and(s[i+1]<>'') then
begin
if pos('/',s[i+1])=0 then
begin
f[i]:=10;
for j:=1 to 2 do
begin
s2:=copy(s[i+1],j,1);
val(s2,temp,code);
f[i]:=f[i]+temp;
end;
end;
if pos('/',s[i+1])<>0 then
f[i]:=20;
end;
if (s[i]<>'/')and(length(s[i])=2) then
begin
if pos('/',s[i])=0 then
for j:=1 to 2 do
begin
s2:=copy(s[i],j,1);
val(s2,temp,code);
f[i]:=f[i]+temp;
end;
if pos('/',s[i])<>0 then
begin
if (pos('/',s[i+1])=0)and(s[i+1]<>'') then begin
s2:=copy(s[i+1],1,1);
val(s2,temp,code);
f[i]:=10+temp;
end;
if s[i+1]='/' then f[i]:=20;
if (pos('/',s[i+1])<>0)and(s[i+1]<>'/') then
begin
s2:=copy(s[i+1],1,1);
val(s2,temp,code);
f[i]:=10+temp;
end;
end;
end;
end;
temp:=0;
j:=tol;
while f[j]=0 do dec(j);
for i:=1 to j do
begin
temp:=temp+f[i];
c[i]:=temp;
end;
for i:=1 to j do
write(f[i],' ');
writeln;
for i:=1 to j do
write(c[i],' ');
close(output);
end.