比赛 20090927练习赛 评测结果 WAAAWA
题目名称 跳远 最终得分 66
用户昵称 lc 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-09-27 20:50:00
显示代码纯文本
program p01;
 const
   maxn = 100;
 var
   n:           longint;
   v0:          double;
   len:         array[1..maxn] of double;
   sum:         array[0..maxn] of double;
   ans:         array[1..maxn] of longint;



procedure init;
 var
   i:   longint;
 begin
   readln(n,v0);
   for i :=1 to n do read(len[i]);
   for i :=1 to n do sum[i] :=sum[i-1] + len[i];
 end;

function can(i,j:longint):boolean;
 var
   k:           longint;
   vt_gt,vt,gtt,t,v,s,tt,yy:    double;

 begin
   vt_gt :=(len[j]-len[i])*(sqrt(3))/2;
   vt := sum[j-1]-sum[i] + (len[i]+len[j])/2;
   gtt :=(vt - vt_gt)*2/10;
   if gtt <0 then exit(false);
   t :=sqrt(gtt);
   v :=vt / t;
   if v >v0 then exit(false);
   for k :=i+1 to j-1 do begin
       s :=sum[k-1]-sum[i] + (len[i]+len[k])/2;
       tt :=s/v;
       yy :=len[i]*sqrt(3)/2 + v*tt - 10*tt*tt/2;
       if yy <=len[k]*sqrt(3)/2 then exit(false);
       end;
   exit(true);
 end;


procedure main;
 var
   i,j: longint;
 begin
   for i :=1 to n-1 do begin
       ans[i] :=0;
       for j :=n downto i+1 do
       if  can(i,j) then
           begin
           ans[i] :=j; break;
           end;
       end;
   for i :=1 to n-2 do write(ans[i],' '); writeln(ans[n-1]);
 end;

begin
  assign(input,'jump.in');  reset(input);
  assign(output,'jump.out'); rewrite(output);
  init;
  main;
  close(input);  close(output);
end.