- 小飞侠的游园方案
- 2017-01-05 18:45:30 @
Var
n,t,i,j:integer;
s,f,ti:array[1..1000]of integer;
Function max(a,b:integer):integer;
Begin
if a>b then
exit(a);
exit(b);
End;
Begin
readln(n);
readln(t);
for i:=1 to n do
read(f[i],ti[i]);
for i:=1 to n do
for j:=1 to t do
if j>=ti[i] then
s[j]:=max(s[j-1],s[j-ti[i]]+f[i]);
writeln(s[t]);
readln;
End.
0 条评论
目前还没有评论...