讨论 / 水题,背包稍稍优化,AC
cw1234 2011-11-09 06:03:00
点我顶贴 收藏 删除
状态: Accepted

测评机: Xeond[6]

得分: 100分

提交日期: 2011-11-9 21:42:00

有效耗时: 656毫秒

测试结果1: 通过本测试点|有效耗时78ms

测试结果2: 通过本测试点|有效耗时62ms

测试结果3: 通过本测试点|有效耗时63ms

测试结果4: 通过本测试点|有效耗时62ms

测试结果5: 通过本测试点|有效耗时63ms

测试结果6: 通过本测试点|有效耗时78ms

测试结果7: 通过本测试点|有效耗时62ms

测试结果8: 通过本测试点|有效耗时63ms

测试结果9: 通过本测试点|有效耗时62ms

测试结果10: 通过本测试点|有效耗时63ms

var m,n,i,j,k:longint;

ans:array[0..35000] of longint;

begin

fillchar(ans,sizeof(ans),0);

read(m,n);

for j:=1 to n do

begin

read(k);

for i:=m downto k do

if ans[i-k]+k>ans[i] then ans[i]:=ans[i-k]+k;

end;

writeln(ans[m]);

end.

只是在读入上加了点技巧,AC毫无压力,在此留念

#1 quanyuxuan@2011-11-09 06:03:00
回复 删除
回复 楼主cw1234 的帖子

无需贴代码吧 很那啥

查看更多回复
提交回复