讨论 / 为什么呀?
will 2008-07-08 19:05:00
点我顶贴 收藏 删除
查看状态 Show Status

状态题目:金明的预算方案

状态编号: [查看该题]

状态: Unaccepted

测评机: Virmain[1]

得分: 50分

提交日期: 2008-4-7 21:10:00

有效耗时: 92毫秒

测试结果1: 测试结果正确

测试结果2: 测试结果正确

测试结果3: 测试结果错误.错误结果为:7200

正确结果应为:7430

测试结果4: 测试结果正确

测试结果5: 测试结果错误.错误结果为:25900

正确结果应为:26400

测试结果6: 测试结果错误.错误结果为:35300

正确结果应为:36400

测试结果7: 测试结果错误.错误结果为:55290

正确结果应为:59350

测试结果8: 测试结果正确

测试结果9: 测试结果错误.错误结果为:95400

正确结果应为:96000

测试结果10: 测试结果正确

提交代码: program rq6(input,output);

var

n,m:integer;

v,p,q:integer;

a:array[0..60]of integer;

b:array[1..60,1..4,1..2]of longint;

c:array[0..32000]of longint;

max:longint;

h,i,j:integer;

begin{main}

readln(n,m);

fillchar(a,sizeof(a),0);

fillchar(b,sizeof(b),0);

for h:=1 to m do

begin{for}

readln(v,p,q);

if q=0 then

begin inc(a[0]);q:=a[0] end;

inc(a[q]);

b[q,a[q],1]:=v;

b[q,a[q],2]:=v*p

end;{for}

for h:=1 to a[0] do

if a[h]=3 then

begin{for}

inc(a[h]);

b[h,4,1]:=b[h,1,1]+b[h,2,1]+b[h,3,1];

b[h,4,2]:=b[h,1,2]+b[h,2,2]+b[h,3,2];

b[h,2,1]:=b[h,1,1]+b[h,2,1];

b[h,2,2]:=b[h,1,2]+b[h,2,2];

b[h,3,1]:=b[h,1,1]+b[h,3,1];

b[h,3,2]:=b[h,1,2]+b[h,3,2];

end;{for}

for h:=1 to a[0] do

if a[h]=2 then

begin{for}

b[h,2,1]:=b[h,1,1]+b[h,2,1];

b[h,2,2]:=b[h,1,2]+b[h,2,2]

end;{for}

fillchar(c,sizeof(c),255);

c[0]:=0;

for h:=1 to a[0] do

for i:=n downto 0 do

if c[i]>=0 then

for j:=1 to a[h] do

if(b[h,a[h],1]+i<=n)and(c[b[h,a[h],1]+i]<c[i]+b[h,a[h],2])then

c[b[h,a[h],1]+i]:=c[i]+b[h,a[h],2];

max:=0;

for h:=1 to n do

if max<c[h] then max:=c[h];

write(max)

end.{main}

那50分为什么得不到,谁给讲讲?

#1 sunrise@2008-07-08 19:05:00
回复 删除
注意物品编号

不要改动输入时的主件编号

否则附件编号指向错误

查看更多回复
提交回复