回帖:var
opt : array[0..1000] of longint;
n , m , w , v : longint;
begin
readln(n,m);
fillchar(opt,sizeof(opt),0);
for i := 1 to n do
begin
readln(w,v);
for j := m downto w do
if opt < opt + v then opt := opt + v;
end;
writeln(f);
end.

