比赛 NOIP_2 评测结果 AAAAAAAAAA
题目名称 驾车旅行 最终得分 100
用户昵称 dingding 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-09-08 21:15:12
显示代码纯文本
program tour;
var
   s:array[0..51]of real;
   w:array[1..51]of real;
   f:array[0..60]of real;
   n,i,j:longint;
   sheng,long,t,v,min:real;
   bo:boolean;
   f1,f2:text;
begin
   assign(f1,'tour.in'); assign(f2,'tour.out');
   reset(f1); rewrite(f2);
   read(f1,long,t,v,f[0],n);
   for i:=1 to n do
   begin
   read(f1,s[i],w[i]);
   f[i]:=100000000;
   min:=100000000;
   s[0]:=0; s[n+1]:=long;
   end;
   for i:=1 to n do
   for j:=0 to i-1 do
   begin
   bo:=false;
   sheng:=t-(s[i]-s[j])/v;
   if sheng<(t/2) then bo:=true;
   if s[i+1]-s[j]>(t*v) then bo:=true;
   if ((s[i]-s[j])<=(t*v))and(bo=true) then
   if f[i]>(f[j]+20+(s[i]-s[j])/v*w[i]) then
   f[i]:=f[j]+20+(s[i]-s[j])/v*w[i];
   end;
   for i:=0 to n do
   if ((long-s[i])<=(t*v))and(min>f[i]) then min:=f[i];
   min:=min*10;
   min:=round(min);
   min:=min/10;
   write(f2,min:0:1);
   close(f1); close(f2);
end.