转:自编双色球缩水程序(C语言)
以下是本人自编自用的双色球缩水程序,四年多来本人最多一次中过3000(离500W就一个数,28与29的差别),中过十几次200。儿子杨朗死后就再也没有用过该程序。现将其公布在天涯,以感谢天涯对本人的支持。
编程的思路是以前面的30期为数据统计依据,计算下一期要出的号码。懂C的朋友如有不解之处,可给本人发短信,共同探讨。
转的C语言原贴链接Sub YangLang_SSQ_30期数据()
rngB = "5,7,10,14,17,25-5,8,10,15,23,26-3,7,13,23,27,30-7,13,17,26,32,33-10,11,13,16,19,30-10,19,20,21,23,32-2,5,11,26,30,32-1,2,14,23,28,29-8,12,20,22,30,33-2,15,19,24,31,32-4,10,16,23,28,30-6,11,18,20,25,30-3,5,12,18,21,23-1,2,9,10,21,31-4,5,23,26,31,32-1,3,12,20,21,29-9,16,17,18,22,27-5,10,16,19,23,28-1,13,15,17,20,30-9,18,19,25,28,31-1,9,14,16,28,32-5,7,12,14,15,20-2,9,16,21,30,31-1,11,13,25,32,33-4,5,6,25,29,30-11,15,18,21,27,29-2,8,12,18,24,28-4,9,11,20,32,33-4,8,12,17,20,30-11,12,13,18,23,32" '开奖号码
sint_A = Split(rngB, "-")
For col = 0 To UBound(sint_A)
sint_Aa = Split(sint_A(col), ",")
For N = 0 To UBound(sint_Aa)
Cells(col + 51, N + 1) = sint_Aa(N)
Next
Next
End Sub
Public Sub YangLang_SSQ(ssjg() As String)
Application.Calculation = 3
Dim startTimer As Double
startTimer = Timer
Dim BaseMin As Integer, BaseMax As Integer, BaseNum As Integer
BaseMin = 1: BaseMax = 33: BaseNum = 6
Dim col As Integer, N As Integer, tRow As Integer, Base()
Base = Range("A51:F80"): tRow = UBound(Base, 1)
Dim pT As Integer, i As Integer, k As Integer
For pT = 0 To (tRow - 30)
RowF = tRow - pT
nStart = RowF - (30 - 1)
nStar5 = RowF - (5 - 1)
Row = RowF
Dim C(33) As Integer
For k = BaseMin To BaseMax
C(k) = 0
For i = nStart To RowF
For N = 1 To BaseNum
If Val(Base(i, N)) = k Then C(k) = C(k) + 1
Next
Next
Next
Dim e(33) As Integer
For k = BaseMin To BaseMax
e(k) = 0
For i = nStar5 To RowF
For N = 1 To BaseNum
If Val(Base(i, N)) = k Then e(k) = e(k) + 1
Next
Next
Next
Dim D(6) As Integer, f(6) As Integer, nNum(10) As Integer, Z As Integer, R As Integer, X As Integer
For k = BaseMin To BaseMax
Hz = 0: R = 0: X = 0
For N = 1 To BaseNum
If Val(Base(RowF, N)) = k Then D(N - 1) = C(k): f(N - 1) = e(k): nNum(N) = k
Z = Z + nNum(N): R = R + D(N - 1): X = X + f(N - 1)
Next
Next
Dim Cs(12) As Integer, Lh(12) As Integer, v As Integer, p As Integer, yNum(10)
For v = 0 To 12
Cs(v) = 0: Lh(v) = 0
For p = 0 To BaseNum - 1
If D(p) = v Then Cs(v) = Cs(v) + 1
If f(p) = v Then Lh(v) = Lh(v) + 1
Next
Next
Cells(Row, 17) = Z: Cells(Row, 18) = R: Cells(Row, 19) = X
Next
ReDim ssjg(0 To 999, 0 To 16)
Dim S As Integer, j As Integer, N1 As Integer, N2 As Integer, N3 As Integer, N4 As Integer, N5 As Integer, N6 As Integer
S = 0
For io = 0 To 7
D(0) = C(io + 1): f(0) = e(io + 1): N1 = io + 1
For i1 = 7 To 9
If i1 > io Then
D(1) = C(i1 + 1): f(1) = e(i1 + 1): N2 = i1 + 1
For i2 = 10 To 24
If i2 > i1 Then
D(2) = C(i2 + 1): f(2) = e(i2 + 1): N3 = i2 + 1
For i3 = 4 To 29
If i3 > i2 Then
D(3) = C(i3 + 1): f(3) = e(i3 + 1): N4 = i3 + 1
For i4 = 10 To 31
If i4 > i3 Then
D(4) = C(i4 + 1): f(4) = e(i4 + 1): N5 = i4 + 1
For i5 = 15 To 32
If i5 > i4 Then
D(5) = C(i5 + 1): f(5) = e(i5 + 1): N6 = i5 + 1
R = 0: Z = 0: X = 0
Z = N1 + N2 + N3 + N4 + N5 + N6
yNum(1) = N1: yNum(2) = N2: yNum(3) = N3: yNum(4) = N4: yNum(5) = N5: yNum(6) = N6
R = (D(0) + 0) + (D(1) + 0) + (D(2) + 0) + (D(3) + 0) + (D(4) + 0) + (D(5) + 0)
X = (f(0) + 0) + (f(1) + 0) + (f(2) + 0) + (f(3) + 0) + (f(4) + 0) + (f(5) + 0)
For v = 0 To 12
Cs(v) = 0: Lh(v) = 0
For p = 0 To BaseNum - 1
If D(p) = v Then Cs(v) = Cs(v) + 1
If f(p) = v Then Lh(v) = Lh(v) + 1
Next
Next
If (R = 25 Or R = 27 Or R = 33) And (Z = 88 Or Z = 94 Or Z = 100 Or Z = 66) And (X = 5 Or X = 7) _
And N1 < N2 And N2 < N3 And N3 < N4 And N4 < N5 And N5 < N6 And (N1 = 1 Or N1 = 3 Or N1 = 5 Or N1 = 6) _
And (N6 = 22 Or N6 = 24 Or N6 = 26 Or N6 = 27 Or N6 = 28 Or Z = 31) And (N2 < 11) Then
If (Cs(2) + Cs(4)) >= 1 And Cs(7) = 0 And Cs(8) >= 1 And Cs(9) <= 1 And Cs(2) <= 2 And Cs(6) >= 1 _
And Cs(5) <= 2 And Cs(6) <= 3 And Cs(4) <= 1 And (Cs(2) >= 2 Or Cs(5) = 2 Or Cs(6) >= 2) _
And Lh(0) >= 2 And Lh(0) <= 3 And Lh(1) >= 1 And Lh(1) <= 2 And (Lh(2) + Cs(3)) >= 1 Then
For N = 1 To BaseNum
ssjg(S, N + 1) = yNum(N)
Next
ssjg(S, BaseNum + 2) = S + 1
ssjg(S, BaseNum + 4) = Z: ssjg(S, BaseNum + 5) = R: ssjg(S, BaseNum + 6) = X
ssjg(S, BaseNum + 7) = "'" & D(0) & D(1) & D(2) & D(3) & D(4) & D(5)
ssjg(S, BaseNum + 8) = "'" & f(0) & f(1) & f(2) & f(3) & f(4) & f(5)
S = S + 1
End If
End If
End If
End If: Next
End If: Next
End If: Next
End If: Next
End If: Next
Next
ssjg(0, 16) = S
'以上程序运行的结果为:
'1 8 19 20 22 24 94 27 645822 020201
'6 8 13 19 20 22 88 27 246582 021020
Application.Calculation = 1
End Sub