|
- Dim arr()
- Dim brr(1 To 100, 1 To 1) As String
- Dim bi As Integer
- Dim js As Integer
- Sub aa()
- tt = Timer
- ks = [a20]
- js = [a21]
- arr1 = [B2:e13]
- arr = arr1
- bi = 0
- 'Call xz(ks, 1, ks)
- ReDim abjrr(1 To UBound(arr)) As Boolean
- abjrr(ks) = True
- Call xz1(ks, 1, ks, abjrr)
- Range("a25").Resize(100, 1).ClearContents
- Range("a25").Resize(bi, 1) = brr
- MsgBox Timer - tt
- End Sub
- Sub xz1(fjh, bs, jl, bj)
- 'fjh房间号, bs步数, jl记录
- For i = bs To UBound(arr, 2)
- If arr(fjh, i) = "" Then '本房间走完
- Exit For
- ElseIf arr(fjh, i) = js Then '到出口
- bi = bi + 1
- brr(bi, 1) = jl & "," & arr(fjh, i)
- Else '进下一间
- If Not bj(arr(fjh, i)) Then
- bj1 = bj
- bj1(arr(fjh, i)) = True
- Call xz1(arr(fjh, i), 1, jl & "," & arr(fjh, i), bj1)
- End If
- End If
- Next
- End Sub
复制代码 |
|