记录编号 2348 评测结果 AAAAAAAAAA
题目名称 驾车旅行 最终得分 100
用户昵称 Gravatarfrancis 是否通过 通过
代码语言 Pascal 运行时间 0.045 s
提交时间 2008-09-19 12:50:11 内存使用 0.11 MiB
显示代码纯文本
program tour;
const
fin='tour.in';
fou='tour.out';
var
s:array[0..60]of real;
w:array[0..60]of real;
f:array[0..60]of real;
n,i,j:longint;
sheng,long,t,v,min:real;
bo:boolean;
f1,f2:text;

procedure init;
begin
assign(f1,fin); assign(f2,fou);
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;
end;

begin
init;
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.