- 采药
- 2014-12-01 15:29:02 @
var i,x,k,n,m:longint;
f:array[0..100000]of longint;
w,c:array[0..2000]of longint;
begin
readln(m,n);
for i:=1 to n do readln(w[i],c[i]);
for i:=1 to n do
for x:=m downto w[i] do
if f[x-w[i]]+c[i]>f[x] then f[x]:=f[x-w[i]]+c[i];
writeln(f[m]);
end.
7 条评论
-
yugeyang LV 10 @ 2015-02-28 10:31:07
hehe
-
2015-02-13 14:41:08@
hehe
-
2015-02-13 13:57:09@
竟然AC了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
2014-12-17 19:18:48@
呵呵
-
2014-12-06 21:49:09@
请正确地发布源代码
-
2014-12-03 13:58:33@
我头上有个。。你懂得
-
2014-12-01 15:29:52@
别被骗了!这货叫羊驼
人称草泥马
- 1