本帖最后由 supersp 于 2010-1-20 16:54 编辑
我这里跑起来71ms...应该还能更快一点#Include <Array.au3>
$begin = TimerInit()
Dim $aArray[15] = [51, 8, 13, 2, 52, 61, 37, 85, 19, 11, 7, 62, 22, 38, 79]
_ArraySort($aArray)
Global $mArray[1],$oArray[1],$display[1]
$oArray[0]=0
For $v1 In $aArray
Switch $v1
Case 1 To 57
_ArrayAdd($mArray,$v1)
Case 58 To 105
_ArrayAdd($oArray,$v1)
EndSwitch
Next
_ArrayDelete($mArray, 0)
For $v2 = 0 To UBound($oArray)-1
_xh($oArray[$v2],String($oArray[$v2]),UBound($mArray))
Next
Func _xh($var,$str,$n)
For $i = $n To 0 Step -1
$num = Execute("$var + $mArray[$i]")
Switch $num
Case 105 To 1500
ContinueLoop
Case 102 To 105
_ArrayAdd($display,$str&"+"&String($mArray[$i])&"="&String($num))
Case 1 To 102
_xh($num,$str&"+"&String($mArray[$i]),$i-1)
EndSwitch
Next
EndFunc
_ArrayDelete($display, 0)
$dif = TimerDiff($begin)
_ArrayDisplay($display,"耗时:"&$dif)
|