记录编号 |
2067 |
评测结果 |
AAAAAAAAAA |
题目名称 |
驾车旅行 |
最终得分 |
100 |
用户昵称 |
WaterFire |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.008 s |
提交时间 |
2008-09-11 21:53:04 |
内存使用 |
0.00 MiB |
显示代码纯文本
program waterfire;
const
fin='tour.in';
fout='tour.out';
var
ans,maxl,maxv,lc,bc,p:real;
n,i,j:longint;
ss,l,c:array[0..51] of real;
procedure Init;
var
i:longint;f:text;
begin
assign(f,fin);reset(f);
readln(f,maxl);
read(f,maxv,lc,bc,n);
for i:=1 to n do
readln(f,l[i],c[i]);
close(f);
ss[0]:=maxv;l[0]:=0;c[0]:=bc/maxv;
ss[1]:=maxv-l[1]/lc;l[n+1]:=maxl;
ans:=maxlongint;
end;
procedure search(x:longint);
var
i,j,r:longint;
begin
if x=n+1 then begin
if p<ans then ans:=p; exit;
end;
for r:=0 to 1 do
if r=0 then begin
if ss[x]*lc>l[x+1]-l[x] then begin
ss[x+1]:=ss[x]-(l[x+1]-l[x])/lc;
search(x+1);
ss[x+1]:=ss[x]+(l[x+1]-l[x])/lc;
end;
end;
if r=1 then begin
if not((ss[x]*lc>l[x+1]-l[x])and(ss[x]>maxv/2)) then
begin
ss[x+1]:=maxv-(l[x+1]-l[x])/lc;
p:=p+(maxv-ss[x])*c[x]+20;
search(x+1);
p:=p-(maxv-ss[x])*c[x]-20;
end;
end;
end;
procedure print;
var
i,j:longint;
f:text;
begin
ans:=ans+bc;
assign(f,fout);rewrite(f);
write(f,ans:0:1);
close(f);
end;
begin
Init;
search(1);
print;
end.