比赛 20110923 评测结果 WAAWWA
题目名称 跳远 最终得分 50
用户昵称 weichen 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-09-23 20:54:14
显示代码纯文本
program lx;
type
  ty=record
    x:real;
    y:real;
  end;
var
  a:array[0..11]of ty;
  a1:array[0..11]of integer;
  i,j,m,n,v0,v:integer;
  p,q,long,sum:real;
procedure jump(n1:integer);
var
  i,j:longint;
  m,height,t:real;
begin
  for i:=n1+1 to n do
    begin
      t:=(a[i].x-a[n1].x)/v0;
      height:=a[n1].y+v0*t-5*sqr(t);
      if (i=n1+1) and (height<a[i].y)
        then begin
               a1[n1]:=0;
               exit;
             end;
      if height= a[i].y then
                          begin
                            a1[n1]:=i;
                            exit;
                          end;
      if height> a[i].y then a1[n1]:=i
                        else exit;
    end;
end;
begin
  assign(input,'jump.in');
  reset(input);
  assign(output,'jump.out');
  rewrite(output);
  read(n,v0);
  a[0].x:=0;a[0].y:=0;
  sum:=0;
  for i:=1 to n do
    begin
      read(long);
      a[i].x:=sum+long/2;
      sum:=sum+long;
      a[i].y:=long*sqrt(3)/2;
    end;
  for i:=1 to n-2 do
    begin
      jump(i);
      write(a1[i],' ');
    end;
  jump(n-1);
  write(a1[n-1]);
  close(input);
  close(output);
end.