双色球彩票用变量表示的算法或公式?

2022-11-11 21:20发布

1,代码中有错误 for x=j+1 to 31 》》》》for x=k+1 to 31---------------------------------

1,代码中有错误 for x=j+1 to 31 》》》》for x=k+1 to 31---------------------------------
3条回答

写代码求哈(原问题中for x=j+1 to 31要改成for x=k+1 to 31):

Private Sub Command3_Click()
Dim n As Long, m As Long
Dim i%, j%, k%, x%, y%, z%
Dim a%, b%, c%, d%, e%, f%

a = 3: b = 8: c = 12: d = 15: e = 19: f = 26
For i = 1 To 28
For j = i + 1 To 29
For k = j + 1 To 30
For x = k + 1 To 31
For y = x + 1 To 32
For z = y + 1 To 33
n = n + 1
If i = a And j = b And k = c And x = d And y = e And z = f Then m = n
Next
Next
Next
Next
Next
Next
Print n, m
End Sub