1、采药问题回溯算法constcanmw=7;constmaxv=0;varmaxw,n,j:integer; option,op:array[0..100]ofinteger;recordt weight,value:integer;end;varA:array[]0..100oft;functionknap(i,tw,tv:integer)varj:integer;beginif(i>=n)then begin if(tw<=canmw)and(tv>maxv)then begin maxv:=tv;