mark 组合排列
内部函数 loop
Dim a() As String = args(0)
Dim n As Integer = args(1)
Dim m As Integer = args(2)
Dim b() As String = args(3)
Dim Mm As Integer = args(4)
For i As Integer = n To m Step -1
b(m-1) = i-1
If m > 1 Then
Functions.Execute("loop", a, i-1, m-1, b, Mm)
Else
Dim result As String = ""
For j As Integer = Mm - 1 To 0 Step -1
result &= a(b(j)) & "|"
Next
output.show(result.Trim("|"))
End If
Next
调用
Dim a() As String = {"a", "b", "c", "d"}
Dim b(a.length-1) As String
'n -> 元素个数
'm -> 选取多少个元素
'Mn -> 层级
For i As Integer = 1 To 4
Functions.Execute("loop", a, a.length, i, b, i)
Next