Dim num As Integer Dim strr Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Line Input #1, strr strr = Split(strr, " ") Input #1, num Call rr("", 0) Close #2 Close #1 End End Sub
Public Function rr(k As String, numm As Integer) If Len(k) = num Then Print #2, k Else For i = numm To UBound(strr) rr = rr(k & strr(i), i + 1) Next End If End Function
Dim a() As String Dim n As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x Input #1, n a = Split(x): n = Val(n) Call b("", 0) Close #2 Close #1 End End Sub
Sub b(c, s) If Len(c) = n Then Print #2, c Else For i = s To UBound(a) If InStr(c, a(i)) = 0 Then Call b(c & a(i), i + 1) Next i End If End Sub
Dim num As Integer
回覆刪除Dim strr
Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Line Input #1, strr
strr = Split(strr, " ")
Input #1, num
Call rr("", 0)
Close #2
Close #1
End
End Sub
Public Function rr(k As String, numm As Integer)
If Len(k) = num Then
Print #2, k
Else
For i = numm To UBound(strr)
rr = rr(k & strr(i), i + 1)
Next
End If
End Function
Dim a() As String
回覆刪除Dim n As Integer
Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
Input #1, n
a = Split(x): n = Val(n)
Call b("", 0)
Close #2
Close #1
End
End Sub
Sub b(c, s)
If Len(c) = n Then
Print #2, c
Else
For i = s To UBound(a)
If InStr(c, a(i)) = 0 Then Call b(c & a(i), i + 1)
Next i
End If
End Sub