只需一步,快速开始
使用道具 举报
Option Compare Database Option Explicit Dim N(8) As Integer Public Sub Calc() Dim i As Integer Dim t1 As Single t1 = Timer For i = 1 To 1000 N(0) = 5 N(1) = 1 N(2) = 3 N(3) = 7 N(4) = 9 N(5) = 2 N(6) = 4 N(7) = 6 N(8) = 8 P1379 Next i Debug.Print Timer - t1 End Sub Private Sub P1379(Optional x As Integer = 1) Dim y As Integer Dim tmp As Integer If x = 4 Then P2468 Exit Sub Else P1379 x + 1 For y = x + 1 To 4 tmp = N(x) N(x) = N(y) N(y) = tmp P1379 x + 1 N(y) = N(x) N(x) = tmp Next y End If End Sub Private Sub P2468(Optional x As Integer = 5) Dim y As Integer Dim tmp As Integer If x = 8 Then If Check Then 'Debug.Print N(1) & N(5) & N(2) & N(6) & N(0) & N(7) & N(3) & N(8) & N(4) End If Exit Sub Else P2468 x + 1 For y = x + 1 To 8 tmp = N(x) N(x) = N(y) N(y) = tmp P2468 x + 1 N(y) = N(x) N(x) = tmp Next y End If End SubPrivate Function Check() As Boolean If (N(1) + N(5) + N(2)) Mod 3 <> 0 Then Exit Function '3 If (N(2) * 10 + N(6)) Mod 4 <> 0 Then Exit Function '4 If (N(1) + N(5) + N(2) + N(6) + N(7)) Mod 3 <> 1 Then Exit Function '6 If (N(7) * 100 + N(3) * 10 + N(8)) Mod 8 <> 0 Then Exit Function '8 If CLng(N(1) & N(5) & N(2) & N(6) & 5 & N(7) & N(3)) Mod 7 <> 0 Then Exit Function '7 Check = True End Function
本版积分规则 发表回复 回帖后跳转到最后一页
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2025-1-11 04:13 , Processed in 0.105273 second(s), 33 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.