PersonalCorpus 版 (精华区)

158231 06:12:58 9 Mar 2002
Bozhang,HIT,P.R.China 1031 Pascal Accepted 1.281 sec 131K


var
    cost,position:array[1..10000] of integer;
    l1,l2,l3,c1,c2,c3:integer;
    a,b,i,j,k,n:integer;
begin
    readln(l1,l2,l3,c1,c2,c3); readln(n);
    readln(a,b); position[1]:=0;
    for i:=2 to n do readln(position[i]);
    if a>b then begin i:=a; a:=b; b:=i end;
    if a=b then begin writeln(0); halt end;
    cost[a]:=0;
    for i:=a+1 to b do begin
        cost[i]:=maxint;
        for j:=i-1 downto a do begin
            k:=position[i]-position[j];
            if k<=l1 then begin
                k:=cost[j]+c1;
                if k<cost[i] then cost[i]:=k;
                continue;
            end;
            if k<=l2 then begin
                k:=cost[j]+c2;
                if k<cost[i] then cost[i]:=k;
                continue;
            end;
            if k<=l3 then begin
                k:=cost[j]+c3;
                if k<cost[i] then cost[i]:=k;
                continue;
            end;
        end;
    end;
    writeln(cost[b]);
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.391毫秒