<!--本過程完成對數組元素取特定組合--> <%
dim result,geted
dim limvalue
ysstr=split("1,20,30,4,51",",")
main
''------------------main完成初始化,及結果處理-------------- sub main
'----------------------初始化----------- limvalue=75 strsub=0 for j=1toubound(ysstr)
strsub=strsub&","&j
next strsub=split(strsub,",")
'-----------------------開始組合--------------- call combo(strsub)
'------------------------result是全局變量,存放下標-------------- xb=split(result,",")
'------------------------輸出結果----------------------- for i=0toubound(xb)
xbs=cint(xb(i))
ww ysstr(xbs)
next end sub ''-----------------------main結束------------------------- ''---------------------主過程 combo----------------------- sub combo(str)
for i=0toubound(str)
if geted then exitsub endif ftmp=pick(str,i)
combo(ftmp)
next end sub ''----------------------子過程pick--------------------------- function pick(strarray,k)
for i=0toubound(strarray)
if i<>k then temp=temp&strarray(i)&"," xb=cint(strarray(i))
numtmp=numtmp+cint(ysstr(xb))
endif next if numtmp=limvalue then'如果結果等於限制的結果 ww numtmp
geted=true result=left(temp,len(temp)-1)
endif iflen(temp)>1then temp=left(temp,len(temp)-1)
endif pick=split(temp,",")
end function sub ww(t)
response.write t
response.write "<BR>" response.flush
end sub %>