用excel在3-11中产生6个数字一组的随机排列组合(数字可以重复),有多少组合?并且把所有的可能列出来 10
4个回答
展开全部
一共有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
如果你需要把所有的可能都列出来
那么给你一段代码,可以在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) 得出数量
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个 我就不列出来了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询