比赛 noip_6 评测结果 WWWWWW
题目名称 打保龄球 最终得分 0
用户昵称 bing 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-26 10:47:19
显示代码纯文本
program bing;
var
 f1,f2:text;
 s:string;
 a:array[1..50] of integer;
 b:array[1..15] of integer;
 c:array[0..15] of integer;
 i:integer;
procedure init;
var
 i,j:integer;
begin
 assign(F1,'bowling.in');reset(f1);
 assign(F2,'bowling.out');rewrite(f2);
 readln(f1,s);
 j:=0;
 fillchar(a,sizeof(a),0);
 for i:=1 to length(s) do
 if (s[i]='/')then
 begin
 if not(s[i-1] in['0'..'9']) then a[i]:=10
 else a[i]:=10-(ord(s[i-1])-ord('0'));
 end
 else a[i]:=ord(s[i])-ord('0');
 fillchar(c,sizeof(c),0);
end;
procedure nb;
var
 i,j:integer;
begin
 i:=0;j:=0;
 repeat inc(i);
 if a[i]+a[i+1]>=10 then begin inc(j);b[j]:=a[i]+a[i+1]+a[i+2];
  if a[i]+a[i+1]=10 then inc(i);end
 else begin inc(j);b[j]:=a[i]+a[i+1];inc(i);end;
 until i>=length(s);
 for i:=1 to 10 do
 c[i]:=b[i]+c[i-1];
end;

begin
 init;
 nb;
 for i:=1 to 10 do write(f2,b[i],' ');
 writeln(f2);
 for i:=1 to 10 do write(F2,c[i],' ');
 close(F1);close(F2);
end.