var i,j,n,m,k,m1,m2,max:longint;
c:array[1..100,1..100]of longint;
p:array[1..100,0..100]of longint;
begin
readln(n,m);m1:=0;m2:=0;
for i:=1 to n do
begin
while (not eoln) do
begin
read(m1);
inc(m2);
c[i,m2]:=m1;
end;
if m2>max then max:=m2;
for j:=1 to m2 do
if i=1 then p[i,j]:=c[i,j];
m2:=0;
readln;
end;
for i:=2 to n do
for j:=1 to max do
for k:=1 to j do
if p[i-1,j-k]+c[i,k]>p[i,j] then
p[i,j]:=p[i-1,j-k]+c[i,k];
writeln(p[n,m]);
end.
状态: Unaccepted
测评机: Xeost[5]
得分: 80分
提交日期: 2009-6-30 10:05:00
有效耗时: 1188毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时156ms
测试结果4: 通过本测试点|有效耗时157ms
测试结果5: 通过本测试点|有效耗时172ms
测试结果6: 通过本测试点|有效耗时156ms
测试结果7: 通过本测试点|有效耗时156ms
测试结果8: 测试结果错误.错误结果为:5018
正确结果应为:37
测试结果9: 通过本测试点|有效耗时172ms
测试结果10: 测试结果错误.错误结果为:61
正确结果应为:3
快来!!!!!!
var
a:array[0..100,0..100] of longint;
f:array[0..100] of longint;
i,j,k,t,m,n:longint;
begin
readln(n,m);
for i:=1 to n do begin
for j:=1 to m do
read(a[i,j]);
readln;
end;
for i:=1 to n do
for j:=m downto 0 do
for k:=1 to m do
if j>=k then
if f[j]<f[j-k]+a[i,k] then
f[j]:=f[j-k]+a[i,k];
write(f[m]);
end.