【数字排列】从1到6的6个数字排列组合说明,每组数字必须由6个数组成,1和6...
答案:2 悬赏:50 手机版
解决时间 2021-03-11 00:09
- 提问者网友:皆是孤独
- 2021-03-10 11:56
【数字排列】从1到6的6个数字排列组合说明,每组数字必须由6个数组成,1和6...
最佳答案
- 五星知识达人网友:末日狂欢
- 2021-03-10 13:13
【答案】 13680种,EXCEL中用程序跑遍所有情况,剔除不符的.
EXCEL里,菜单——工具——宏——V…B…编辑器
在编辑器界面,菜单——插入——模块
在模块1里粘贴如下代码:
Sub Macro1()
Range(A1).Select
Dim i1,i2,i3,i4,i5,i6,n,k,p,q,flag
Dim tstr,nstr,dbstr
Dim tshuzu(7)
n = 0
For i1 = 1 To 6
For i2 = 1 To 6
For i3 = 1 To 6
For i4 = 1 To 6
For i5 = 1 To 6
For i6 = 1 To 6
tstr = i1 & i2 & i3 & i4 & i5 & i6
flag = 1
For k = 1 To 6
If InStr(tstr,11 * k) 0 Then
flag = 0
Exit For
End If
Next
If InStr(tstr,16) 0 Or InStr(tstr,61) 0 Then
flag = 0
End If
If flag = 1 Then
tshuzu(1) = i1
tshuzu(2) = i2
tshuzu(3) = i3
tshuzu(4) = i4
tshuzu(5) = i5
tshuzu(6) = i6
For p = 1 To 5
For q = p + 1 To 6
If tshuzu(p) > tshuzu(q) Then
t = tshuzu(p)
tshuzu(p) = tshuzu(q)
tshuzu(q) = t
End If
Next
Next
nstr = tshuzu(1) & tshuzu(2) & tshuzu(3) & tshuzu(4) & tshuzu(5) & tshuzu(6)
For k = 1 To 6
If InStr(nstr,1111 * k) 0 Then
flag = 0
Exit For
End If
Next
dbstr =
For k = 1 To 6
If InStr(dbstr,tshuzu(k)) = 0 Then
dbstr = dbstr & tshuzu(k)
End If
Next
If Len(dbstr)
EXCEL里,菜单——工具——宏——V…B…编辑器
在编辑器界面,菜单——插入——模块
在模块1里粘贴如下代码:
Sub Macro1()
Range(A1).Select
Dim i1,i2,i3,i4,i5,i6,n,k,p,q,flag
Dim tstr,nstr,dbstr
Dim tshuzu(7)
n = 0
For i1 = 1 To 6
For i2 = 1 To 6
For i3 = 1 To 6
For i4 = 1 To 6
For i5 = 1 To 6
For i6 = 1 To 6
tstr = i1 & i2 & i3 & i4 & i5 & i6
flag = 1
For k = 1 To 6
If InStr(tstr,11 * k) 0 Then
flag = 0
Exit For
End If
Next
If InStr(tstr,16) 0 Or InStr(tstr,61) 0 Then
flag = 0
End If
If flag = 1 Then
tshuzu(1) = i1
tshuzu(2) = i2
tshuzu(3) = i3
tshuzu(4) = i4
tshuzu(5) = i5
tshuzu(6) = i6
For p = 1 To 5
For q = p + 1 To 6
If tshuzu(p) > tshuzu(q) Then
t = tshuzu(p)
tshuzu(p) = tshuzu(q)
tshuzu(q) = t
End If
Next
Next
nstr = tshuzu(1) & tshuzu(2) & tshuzu(3) & tshuzu(4) & tshuzu(5) & tshuzu(6)
For k = 1 To 6
If InStr(nstr,1111 * k) 0 Then
flag = 0
Exit For
End If
Next
dbstr =
For k = 1 To 6
If InStr(dbstr,tshuzu(k)) = 0 Then
dbstr = dbstr & tshuzu(k)
End If
Next
If Len(dbstr)
全部回答
- 1楼网友:患得患失的劫
- 2021-03-10 14:48
收益了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯