69,369
社区成员
发帖
与我相关
我的任务
分享
Sub 丑陋的穷举法()
Dim i As Long, j As Long
i = 1
Do
j = i
If j Mod 5 = 1 Then 'a
j = (j \ 5) * 4
If j Mod 5 = 1 Then 'b
j = (j \ 5) * 4
If j Mod 5 = 1 Then 'c
j = (j \ 5) * 4
If j Mod 5 = 1 Then 'd
j = (j \ 5) * 4
If j Mod 5 = 1 Then 'e
Exit Do
End If
End If
End If
End If
End If
i = i + 1
Loop
MsgBox i 'i= 3121
End Sub
Sub xyz()
Dim i As Long, j As Long
i = 1
Do
j = i
If j Mod 5 = 1 Then 'a
j = j \ 5 * 4
If j Mod 5 = 1 Then 'b
j = j \ 5 * 4
If j Mod 5 = 1 Then 'c
j = j \ 5 * 4
If j Mod 5 = 1 Then 'd
j = j \ 5 * 4
If j Mod 5 = 1 Then 'e
Exit Do
End If
End If
End If
End If
End If
i = i + 1
Loop
MsgBox i 'i= 168421
End Sub