讨论 / 帮忙看看代码啊啊啊啊
wwjjxx 2014-01-25 14:52:08
点我顶贴 收藏 删除
var a,f:array[-900..1000]of longint;

i,x,n,j,s,t,m,min:longint;

begin

readln(n);

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

fillchar(f,sizeof(f),0);

readln(s,t,m);

for i:=1 to m do

begin

read(x);

a[x]:=1;

end;

for i:=1 to n do

begin

min:=maxlongint;

for j:=s to t do

begin

if min>(f[i-j]+a[i]) then

min:=(f[i-j]+a[i]);

end;

f[i]:=min;

end;

writeln(f[n]);

end.

查看更多回复
提交回复