- NightElf
- 2009-11-03 14:19:15 @
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 条评论
-
916723567 LV 9 @ 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