有效耗时: 1000毫秒
测试结果1: 通过本测试点|有效耗时172:ms
测试结果2: 通过本测试点|有效耗时47:ms
测试结果3: 通过本测试点|有效耗时47:ms
测试结果4: 通过本测试点|有效耗时172:ms
测试结果5: 通过本测试点|有效耗时47:ms
测试结果6: 通过本测试点|有效耗时63:ms
测试结果7: 通过本测试点|有效耗时47:ms
测试结果8: 通过本测试点|有效耗时172:ms
测试结果9: 通过本测试点|有效耗时62:ms
测试结果10: 通过本测试点|有效耗时171:ms
本题评测结果:
有效耗时: 该状态没有记录
测试结果1: 运行错误|未定义错误编号|错误编号:104
测试结果2: 运行错误|未定义错误编号|错误编号:186
测试结果3: 运行错误|未定义错误编号|错误编号:615
测试结果4: 测试结果错误.错误结果为:150080694
正确结果应为:81755
测试结果5: 运行错误|未定义错误编号|错误编号:872
测试结果6: 运行错误|未定义错误编号|错误编号:310
测试结果7: 运行错误|未定义错误编号|错误编号:681
测试结果8: 运行错误|未定义错误编号|错误编号:844
测试结果9: 测试结果错误.错误结果为:114573698
正确结果应为:45060
测试结果10: 运行错误|未定义错误编号|错误编号:737
源程序:
var a:array[0..10000,0..10000]of longint;
tm,mn:array[1..100]of longint;
i,j,m,t:longint;
begin
readln(t,m);
for i:=1 to m do readln(tm[i],mn[i]);
for i:=1 to m do begin
for j:=1 to t do begin
if tm[i]>j then a[i,j]:=a[i-1,j];
if tm[i]<=j then
if a[i-1,j]>=a[i-1,j-tm[i]]+mn[i] then a[i,j]:=a[i-1,j] else a[i,j]:=a[i-1,j-tm[i]]+mn[i];
end;
end;
writeln(a[m,t]);
end.