Non-recurrent realization of unremissive sequences (2)

zhaozj2021-02-16  109

The code for retrospective algorithm is given below, and the code (http://community.9cbs.net/expert/topic/2909/2909080.xml?temp =.9990503) is slightly modified:

Sub Pailie2 (Paramarray X ()) Dim StartTime As Single, EndTime As Singledim I AS Integer, J AS Integer, Num As Long, N AS Integerdim A () AS Integer 'Number Address DIM B () AS Integer' records Identification n = ubound (x) 1startTime = Timer 'Starting Redim A (1 to n) Redim B (1 to n) i = 1a (1) = 0do while i <= n ?? a (i) = A ( I) 1 ?? IF a (i) <= n Then ????? IF B (a (i)) = 0 THEN ???????? IF i = n Then 'reaches the end of the array, then Output combination situation ???????????? for j = 1 to n ????????????? debug.print X (A (J) - 1) & " ? 'Output ???????????? next ??????????? debug.print ??????????? Num = Num 1 ???? ???????? i = i - 1 ???????????? b (A (i)) = 0 'clears the identity ????????? Else ?? ?????????? b (a (i)) = 1 'mark has been used ???????????? I = i 1 ?????????? ?? a (i) = 0 'review ????????? End if ????? end if ?? ELSE ????? i = i - 1 ????? IF i = 0 THEN EXIT Do 'ends before going back to an array ????? b (A (i)) = 0 ?? end if ?? doeventsloopendtime = TimerDebug.print "A total of" & num & "is arranged! Time" & endtime - StartTime & "Second!" End Sub

PRIVATE SUB Command1_Click () Pailie2 "A", "B", "C", "D", "E", "F", "G"

End Sub

转载请注明原文地址:https://www.9cbs.com/read-14533.html

New Post(0)