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

144
提问者
2023-03-16 00:19 悬赏 0财富值 阅读 554回答 3

我做了个选号程序,需要源代码可以HI我。#p#1,代码中有错误 for x=j+1 to 31 》》》》for x=k+1 to 31----------

默认分类
登录 后发表回答
1楼 · 2023-03-16 00:48.采纳回答

写代码求哈(原问题中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

2楼-- · 2023-03-16 00:32

1,代码中有错误
for x=j+1 to 31 》》》》for x=k+1 to 31
-------------------------------------------
你的意思就是算位置,既然是组合,肯定就用组合公式推导了。
反推:(为少打点字,以6选3为例)
k为6
公式C(m,n)为m选n组合

f(x,y,z)=C(6,3)-[ C((k-x),3) + C((k-y),2) + C((k-z),1) ]

正推就自己推吧!

Mother asked .
A. were there any cheaper shoes
B. there are some cheaper shoes
C. if there were any cheaper shoes
D. if there are any cheaper shoes

3楼-- · 2023-03-16 00:38

我做了个选号程序,需要源代码可以HI我。