比赛 |
noip_6 |
评测结果 |
WWAAWA |
题目名称 |
打保龄球 |
最终得分 |
50 |
用户昵称 |
francis |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-10-08 19:54:43 |
显示代码纯文本
program bowling;
const
fin='bowling.in';
fou='bowling.out';
var
a:array[0..15,1..2]of longint;
ch:array[1..15,1..2]of char;
x,y,n,l,p,i,j:longint;
st:string;
c:char;
f1,f2:text;
procedure init;
begin
assign(f1,fin);
assign(f2,fou);
reset(f1); rewrite(f2);
readln(f1,st);
repeat
inc(n);
l:=length(st);
p:=pos(' ',st);
if p=2 then begin ch[n,1]:=st[1]; ch[n,2]:=' '; end;
if p=3 then begin ch[n,1]:=st[1]; ch[n,2]:=st[2]; end;
st:=copy(st,p+1,l-p);
until p=0;
if l=1 then ch[n,1]:=st[1];
if l=2 then begin ch[n,1]:=st[1]; ch[n,2]:=st[2]; end;
end;
function num(c:char):longint;
begin
if c='/' then num:=10
else num:=ord(c)-48;
end;
begin
init;
for i:=1 to 10 do
begin
x:=num(ch[i+1,1]);
if ch[i+1,2]<>' ' then y:=num(ch[i+1,2])
else y:=num(ch[i+2,1]);
if (x<10)and(y=10) then y:=10-x;
if ch[i,1]='/' then a[i,1]:=10+x+y
else
if ch[i,2]='/' then a[i,1]:=10+x else a[i,1]:=num(ch[i,1])+num(ch[i,2]);
a[i,2]:=a[i-1,2]+a[i,1];
end;
for i:=1 to 9 do write(f2,a[i,1],' '); writeln(f2,a[10,1]);
for i:=1 to 9 do write(f2,a[i,2],' '); write(f2,a[10,2]);
close(f1); close(f2);
end.