记录编号 1852 评测结果 AAAAAAAAAA
题目名称 驾车旅行 最终得分 100
用户昵称 GravatarMayLava 是否通过 通过
代码语言 Pascal 运行时间 0.052 s
提交时间 2008-09-09 13:09:01 内存使用 0.11 MiB
显示代码纯文本
program MayLava;
type
 rec=record
  dis,pri:double;
 end;
var
 os:array[0..51]of rec;
 goa,box,per,tbox,total,min:double;
 n: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
  t,tb,tt: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+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);
  writeln(f,min/10:0:1);
  close(f);
 end;
BEGIN
 start;
 main;
END.