Dim n As Integer Dim a() As String Private Sub Form_Load() Me.Hide Dim ans As Integer Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Line Input #1, x Input #1, n a = Split(x) Call abc("", 0) Close Close End End Sub Sub abc(b, c) If Len(b) = n Then Print #2, b Else For i = c To UBound(a) If InStr(b, a(i)) = 0 Then Call abc(b & a(i), i + 1) Next End If End Sub
Dim x As Integer Dim a() As String 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, n Input #1, x a = Split(n) Call d("", 0) Close #2 Close #1 End End Sub
Sub d(b, c) If Len(b) = Val(x) Then Print #2, b Else For i = c To UBound(a) If InStr(b, a(i)) = 0 Then Call d(b & a(i), i + 1) Next i End If End Sub
Dim n As Integer
回覆刪除Dim a() As String
Private Sub Form_Load()
Me.Hide
Dim ans As Integer
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Line Input #1, x
Input #1, n
a = Split(x)
Call abc("", 0)
Close
Close
End
End Sub
Sub abc(b, c)
If Len(b) = n Then
Print #2, b
Else
For i = c To UBound(a)
If InStr(b, a(i)) = 0 Then Call abc(b & a(i), i + 1)
Next
End If
End Sub
Dim x As Integer
回覆刪除Dim a() As String
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, n
Input #1, x
a = Split(n)
Call d("", 0)
Close #2
Close #1
End
End Sub
Sub d(b, c)
If Len(b) = Val(x) Then
Print #2, b
Else
For i = c To UBound(a)
If InStr(b, a(i)) = 0 Then Call d(b & a(i), i + 1)
Next i
End If
End Sub