只需一步,快速开始
使用道具 举报
Public Sub Ck() Dim i As Integer, j As Integer, k As Integer Dim t1 As Double, t2 As Double, w As String t1 = Timer For k = 1 To 100 For i = 123 To 333 For j = 1 To 9 If InStr(1, i & 2 * i & 3 * i, j) = 0 Then Exit For Next j If j > 9 Then w = i & " " & 2 * i & " " & 3 * i Next i Next k t2 = Timer Debug.Print (t2 - t1) / 100 End Sub
Public Sub Test() Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, num As Long Dim t1 As Double, t2 As Double Dim data() As Byte Dim tags(8) As Boolean Dim w As String t1 = Timer For m = 1 To 1000 For i = 1 To 3 For j = 1 To 9 If j <> i Then For k = 1 To 9 If k <> i And k <> j Then num = i * 100 + j * 10 + k If num > 329 Then GoTo NOT_THIS data = CStr(num * 1000000 + num * 2000 + num * 3) Erase tags For l = 0 To UBound(data) Step 2 If data(l) = 48 Then GoTo NOT_THIS If tags(data(l) - 49) Then GoTo NOT_THIS tags(data(l) - 49) = True Next l w = num & " " & num * 2 & " " & num * 3 End If NOT_THIS: Next k End If Next j Next i Next m t2 = Timer Debug.Print (t2 - t1) ; "毫秒" End Sub
Public Sub Test5() Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer Dim Num As Integer, Num2 As Integer, Num3 As Integer Dim t1 As Double, t2 As Double Dim data() As Byte Dim tag As Long Dim tags(9) As Long Dim w As String t1 = Timer For i = 0 To 9 tags(i) = 2 ^ i Next i For m = 1 To 10000 For i = 1 To 3 For j = 1 To 9 If j <> i Then For k = 1 To 9 If k <> i And k <> j Then Num = i * 100 + j * 10 + k If Num > 329 Then Exit For Num2 = Num + Num Num3 = Num + Num2 tag = 0 tag = tag Or tags(i) tag = tag Or tags(j) tag = tag Or tags(k) tag = tag Or tags((Num2) \ 100) tag = tag Or tags(((Num2) Mod 100) \ 10) tag = tag Or tags((Num2) Mod 10) tag = tag Or tags((Num3) \ 100) tag = tag Or tags(((Num3) Mod 100) \ 10) tag = tag Or tags((Num3) Mod 10) If tag = &H3FE Then w = Num & " " & Num * 2 & " " & Num * 3 'Debug.Print w End If End If Next k End If Next j Next i Next m t2 = Timer Debug.Print (t2 - t1) / 10; "毫秒" End Sub
本版积分规则 发表回复 回帖后跳转到最后一页
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2025-1-10 01:31 , Processed in 0.116346 second(s), 33 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.