Dim cn() As String
Dim cs As Integer
Dim cx() As Integer
Dim a() As Integer
Dim x() As Integer
Sub pb()
cs = InputBox("请输入元素的个数:")
ReDim cn(cs)
ReDim a(cs)
ReDim x(cs)
For I = 1 To cs
cn(I) = InputBox("请输入第" & I & "个元素。")
Next
End Sub
Sub try(I As Integer)
Dim j As Integer
DoEvents
For j = 1 To cs
If a(j) = 0 Then
x(I) = j
a(j) = 1
If I < cs Then
try (I + 1)
Else
For t = 1 To cs
If t < cs Then
Debug.Print cn(x(t)) & " ";
Else
Debug.Print cn(x(t))
End If
Next
End If
a(j) = 0
End If
Next
End Sub