比赛 NOIP_2 评测结果 AWWWWWWWWW
题目名称 驾车旅行 最终得分 10
用户昵称 NOIer 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-08 22:03:21
显示代码纯文本
//Problem : Noip;
//Author  : CaiXinXIao;
//Way     : Search;

Program Tour;
Const
  MaxN  = 5000;
  Inf   = 'tour.in';
  Ouf   = 'tour.out';
Var
  A        : array[0..MaxN,1..2] of Real;
  Rout     : array[1..MaxN] of 0..1;
  l,v      : Real;
  p,o      : Real;
  cost,ans : Real;
  i,n      : Longint;

Procedure Init;
  Begin
    assign(input,Inf); reset(input);
    assign(output,Ouf); rewrite(output);
    Read(l,v,p,o,n);
    A[0,1]:=0;
    For i:=1 to n do
    Read(a[i,1],a[i,2]);
    A[n+1,1]:=l;
    Cost:=o;
  End;

Procedure Find(s:real;x:longint);
  Var
    dv,now,stay:Real;
    ii:Longint;
  Begin
    dv:=(a[x,1]-a[x-1,1])/p;
    now:=s-dv;
    if now<0 then exit;
    if x=n+1 then
    begin
      for ii:=1 to n do
        if cost>ans then ans:=cost;
      end
        Else Begin
             if (now*p)<(a[x+1,1]-a[x,1]) then
             Begin
               stay:=cost;
               cost:=cost+20;
               cost:=round((cost+(v-now)*a[x,2])*10)/10;
               rout[x]:=1;
               find(v,x+1);
               cost:=stay;
             end else Begin
                        if now>=(v/2) then
                        Begin
                          stay:=cost;
                          rout[x]:=0;
                          find(now,x+1);
                          cost:=stay;
                        end else Begin
                                   stay:=cost; rout[x]:=0;
                                   find(now,x+1); cost:=stay; cost:=cost+20;
                                   cost:=round((cost+(v-now)*a[x,2])*10)/10;
                                   rout[x]:=1; find(v,x+1); cost:=stay;
                                 End;
                      End;
           End;
End;

Procedure Print;
  Begin
    close(input);
    close(output);
  End;

BEGIN
  Init;
  Find(v,1);
  Writeln(ans:0:1);
  Print;
END.