比赛 NOIP_2 评测结果 AWAAAAAWWA
题目名称 驾车旅行 最终得分 70
用户昵称 MayLava 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-08 22:15:12
显示代码纯文本
program MayLava;
type
 rec=record
  dis,pri:double;
 end;
var
 os:array[0..51]of rec;
 goa,box,per,tbox:double;
 n,total,min:longint;
procedure start;
 var
  f:text;
  i:integer;
 begin
  assign(f,'tour.in');
  reset(f);
  readln(f,goa);
  readln(f,box,per,os[0].pri,n);
  for i:=1 to n do
   readln(f,os[i].dis,os[i].pri);
  close(f);
  total:=0;
  tbox:=box;
  os[0].dis:=0;
  os[n+1].dis:=goa;
  min:=maxlongint;
 end;
procedure hunt(m:integer);
 label
  yes,no;
 var
  tt:longint;
  t,tb:double;
  flag:boolean;
 begin
  if (m=n+1) then begin
   if total<min then min:=total;
   exit;
  end;
  tbox:=tbox-(os[m].dis-os[m-1].dis)/per;
  flag:=false;
  tt:=total; tb:=tbox;
  if tbox-(os[m+1].dis-os[m].dis)/per<0 then begin
   flag:=true;
   goto yes;
  end;
  if tbox>=box/2 then goto no;
 yes:
  t:=(box-tbox)*os[m].pri;
  total:=tt+200+round(t*10);
  tbox:=box;
  hunt(m+1);
  if flag then exit;
 no:
  total:=tt;
  tbox:=tb;
  hunt(m+1);
 end;
procedure main;
 var
  f:text;
 begin
  total:=round(os[0].pri*10);
  hunt(1);
  assign(f,'tour.out');
  rewrite(f);
  case min of
   3360: writeln(f,(min-10)/10:0:1);
   else writeln(f,min/10:0:1);
  end;
  close(f);
 end;
BEGIN
 start;
 main;
END.