怎么老是60分?哪个大牛来救下我.

1648题

哪为大牛帮我看下程序?

program li;

var n,k,ans,tot:longint;

i,j:longint;

a,f,g:array[0..3000] of longint;

function max(x,y:longint):longint;

begin

if x>y then max:=x else max:=y;

end;

begin

readln(n,k);

for i:=1 to n do read(a[i]);

for i:=1 to k do f[i]:=maxlongint;

for j:=0 to k do

for i:=1 to n do

begin

{F[J]是得到J能量时花费最少的天数,G[J]是对应的最大剩余体力}

if (a[i]>=120) or (f[j]=maxlongint) then continue;

if g[j]-a[i]>0 then{这是可以吸收当前能量的时候}

begin

if f[j]

2 条评论

  • @ 2016-03-20 10:39:18

    首先没有置g的初值
    其次循环i在j前并且j用downto
    最后。。。you can’t do it 没写。

  • @ 2009-11-04 17:35:24

    UP

    UP

  • 1

信息

ID
1648
难度
7
分类
动态规划 点击显示
标签
(无)
递交数
1112
已通过
205
通过率
18%
被复制
2
上传者