level 1
使用Array,有20个数字,每4个数字一组,排列出来。该如何写啊?
2020年12月21日 15点12分
1
level 15
这不是排列,而是统计吧,另外统计前四名就一定要每四个数字一组么?
2020年12月22日 12点12分
4
先说排列吧,6个数字为例。4个数字一组,共15组 1234,1235,1236,1245,1246,1256,1345,1346,1356,1456,2345,2346,2356,2456,3456。 统计部分,例如1234,统计N期里面出了几次。
2020年12月22日 13点12分
level 1
Private Sub Command2_Click()
Dim s
Label1.Caption = " "
s = Array(11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
For a = 0 To UBound(s)
For b = 1 To UBound(s)
For c = 2 To UBound(s)
For d = 3 To UBound(s)
If c < d And b < c And a < b Then
z = s(a) & " " & s(b) & " " & s(c) & " " & s(d) & " "
Label1.Caption = Label1.Caption & z & "|"
t = t + 1
End If
Next d
Next c
Next b
Next a
Text1.Text = t
End Sub
我居然是这样实现的。
2020年12月23日 13点12分
6
只是实现找出全部组合的话,这样就可以了,不过还可以简化一下,让b从a+1开始循环,c从b+1开始循环,d从c+1开始循环,就可以省去If判断了,并且减少了循环次数
2020年12月23日 14点12分
麻烦帮我写下吧,现在脑子不太够用了。
2020年12月23日 15点12分
level 11
Private Sub Command1_Click()
Dim s
Label1.Caption = " "
s = Array(11, 12, 13, 14, 15, 16)
For a = 0 To UBound(s)
For b = a + 1 To UBound(s)
For c = b + 1 To UBound(s)
For d = c + 1 To UBound(s)
'If c < d And b < c And a < b Then
z = s(a) & " " & s(b) & " " & s(c) & " " & s(d) & " "
Label1.Caption = Label1.Caption & z & "|"
t = t + 1
'End If
Next d
Next c
Next b
Next a
Text1.Text = t
End Sub
2020年12月24日 02点12分
7