PersonalCorpus 版 (精华区)

156426 02:05:03 7 Mar 2002
Bozhang,HIT,P.R.China 1193 Pascal Accepted 0.02 sec 53K


var
    i,j,k,n:integer;
    t1,t2,t3:array[1..100] of word;
begin
    readln(n);for i:=1 to n do readln(t1[i],t2[i],t3[i]);
    for i:=1 to n-1 do begin
        k:=i; for j:=i+1 to n do if (t1[j]<t1[k]) or ((t1[j]=t1[k]) and (t3[
j]<t3[k])) then k:=j;
        if k<>i then begin
            j:=t1[k] ;t1[k]:=t1[i];t1[i]:=j;
            j:=t2[k] ;t2[k]:=t2[i];t2[i]:=j;
            j:=t3[k] ;t3[k]:=t3[i];t3[i]:=j;
        end;
    end;
    k:=0; j:=0;
    for i:=1 to n do begin
        if t1[i]>k then k:=t1[i];
        k:=k+t2[i];
        if k-t3[i]>j then j:=k-t3[i];
    end;
    writeln(j);
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.117毫秒