比赛 20090927练习赛 评测结果 WAAEEA
题目名称 跳远 最终得分 50
用户昵称 ybh 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-09-27 21:27:54
显示代码纯文本
program TiaoYuan;
var
  n,v0:integer;
  x,y:array[0..10] of real;
  a,l:array[0..10] of integer;
  vt,t,v,t1,y1:real;
  i,j,k:integer;
  bool:boolean;
begin
  assign(input,'jump.in');
  reset(input);
  assign(output,'jump.out');
  rewrite(output);
  readln(n,v0);
  for i:=1 to n do
  begin
    read(l[i]);
    x[i]:=x[i-1]+(l[i]+l[i-1])/2;
    y[i]:=sqrt(3)*(l[i]/2)
  end;
  for i:=1 to n-1 do
  begin
    for j:=n downto i+1 do
    begin
      vt:=x[j]-x[i];
      t:=sqrt((y[i]+vt-y[j])/5);
      v:=vt/t;
      if v<=v0 then
      begin
        bool:=true;
        for k:=i+1 to j-1 do
        begin
          t1:=(x[k]-x[i])/v;
          y1:=y[i]+v*t1-5*t1*t1;
          if y1<=y[k] then
          begin
            bool:=false
          end
        end;
        if bool then
        begin
          a[i]:=j;
          break
        end
      end
    end
  end;
  for i:=1 to n-1 do
    write(a[i],' ');
  close(input);
  close(output)
end.