一共有9^6=531441种
如果你需要把所有的可能都列出来
那么给你一段代码,可以在excel中将全部可能在A~F列列出来
但是,因为计算机速度问题以及组合数量的问题,运算时间会很长哦,中途中断可以用pause/break 键停止
Sub Rand_P()
i = 1
For a = 3 To 11
For b = 3 To 11
For c = 3 To 11
For d = 3 To 11
For e = 3 To 11
For f = 3 To 11
Cells(i, 1) = a
Cells(i, 2) = b
Cells(i, 3) = c
Cells(i, 4) = d
Cells(i, 5) = e
Cells(i, 6) = f
i = i + 1
Next
Next
Next
Next
Next
Next
End Sub
每组有9种可能,共6组,所以组合为9^6=531441种
A1=1
B1=1
for i1=1 to 9
for i2=1 to 9
for i3=1 to 9
for i4=1 to 9
for i5=1 to 9
for i6=1 to 9
IF B1=11 THEN
A1=A1+1
B1=1
CELLS(A1,B1)=i1+3 & "," & i2+3 & "," & i3+3 & "," & i4+3 & "," & i5+3 & "," & i6+3
else
CELLS(A1,B1)=i1+3 & "," & i2+3 & "," & i3+3 & "," & i4+3 & "," & i5+3 & "," & i6+3
B1=B1+1
endif
next
next
next
next
next
next
在第一行第15格输入 =counta(a:j) 得出数量
共有9*9*9*9*9*9个 我就不列出来了。