- 火车票
- 2015-06-02 21:04:40 @
program DP;
var
t,far:array[0..10000] of longint;
i,j,k,l,m,n,l1,l2,l3,c1,c2,c3,a,b,g,x,max:longint;
begin
readln(l1,l2,l3,c1,c2,c3);
readln(n);
readln(a,b);
g:=0;
for i:=2 to n do
readln(far[i]);
t[a]:=0;
for i:=a+1 to b do
begin
max:=1000000000;
for j:=i-1 downto a do
begin
writeln(far[i]-far[j]);
if far[i]-far[j]<=l1
then l:=c1
else if far[i]-far[j]<=l2
then l:=c2
else if far[i]-far[j]<=l3
then l:=c3
else break;
if l+t[j]<max
then max:=l+t[i];
end;
t[i]:=max;
end;
writeln(t[b]);
end.