0.1.2.3.4.5.6.7.8.9选出5个数排7成7位数 例如 12345 可排成1112345和1234511这种排列有多少种。用excel最
关注:241 答案:3 手机版
解决时间 2021-02-26 00:34
- 提问者网友:孤城古巷
- 2021-02-25 09:37
我想把 这些排列 详细的排列在 excel里面 。 每种排列组合都要有的、。
最佳答案
- 二级知识专家网友:不了解我就别说我变了
- 2021-02-25 10:41
按楼主要求,做脚本小工具。这个工具可以手工输入5个数,排出使用这5个数组成的全部7位数。
'WINDOWS下,将以下代码复制到记事本,保存后修改后缀名为“.VBS”。
'双击运行10秒钟直至弹出“完成”。
'结果文件保存在D盘下result_tools.txt。每5个数的结果文件大小均在295K左右。
'BY niminrenshi
on error resume next
rt =InputBox("请在对话框中输入0-9的5个不同数字。" &vbCrlf & "数与数之间用半角空格隔开。" & vbCrlf & "本次运算将会覆盖上次运算的结果文件,请注意保存。","5个数排成7位数小工具","0 1 2 3 4")
rt =Trim(rt)
if rt = vbCancel or rt = "" then
Wscript.Quit
End if
rt =Split (rt," ")
set fso = CreateObject ("SCripting.FileSystemObject")
set hw = fso.CreateTextFile ("D:\result_tools.txt",true,-2)
set wshshell = CreateObject("WScript.Shell")
dim shuzu (8)
for i1 = 0 to 4
for i2 = 0 to 4
for i3 = 0 to 4
for i4 = 0 to 4
for i5 = 0 to 4
for i6 = 0 to 4
for i7 = 0 to 4
nnum = i1 & i2 & i3 & i4 & i5 & i6 & i7
shuzu(1) = i1
shuzu(2) = i2
shuzu(3) = i3
shuzu(4) = i4
shuzu(5) = i5
shuzu(6) = i6
shuzu(7) = i7
for m = 1 to 6
for n = m +1 to 7
if shuzu(m) > shuzu (n) then
t = shuzu(m)
shuzu(m) = shuzu(n)
shuzu(n) = t
end if
next
next
numgs = 0
for m = 2 to 7
if shuzu(m) = shuzu(m-1) then
numgs = numgs + 1
end if
next
if numgs = 2 then
hw.WriteLine nnum
end if
next
next
next
next
next
next
next
hw.Close
MsgBox "完成"
Wscript.Quit
'代码结束
'WINDOWS下,将以下代码复制到记事本,保存后修改后缀名为“.VBS”。
'双击运行10秒钟直至弹出“完成”。
'结果文件保存在D盘下result_tools.txt。每5个数的结果文件大小均在295K左右。
'BY niminrenshi
on error resume next
rt =InputBox("请在对话框中输入0-9的5个不同数字。" &vbCrlf & "数与数之间用半角空格隔开。" & vbCrlf & "本次运算将会覆盖上次运算的结果文件,请注意保存。","5个数排成7位数小工具","0 1 2 3 4")
rt =Trim(rt)
if rt = vbCancel or rt = "" then
Wscript.Quit
End if
rt =Split (rt," ")
set fso = CreateObject ("SCripting.FileSystemObject")
set hw = fso.CreateTextFile ("D:\result_tools.txt",true,-2)
set wshshell = CreateObject("WScript.Shell")
dim shuzu (8)
for i1 = 0 to 4
for i2 = 0 to 4
for i3 = 0 to 4
for i4 = 0 to 4
for i5 = 0 to 4
for i6 = 0 to 4
for i7 = 0 to 4
nnum = i1 & i2 & i3 & i4 & i5 & i6 & i7
shuzu(1) = i1
shuzu(2) = i2
shuzu(3) = i3
shuzu(4) = i4
shuzu(5) = i5
shuzu(6) = i6
shuzu(7) = i7
for m = 1 to 6
for n = m +1 to 7
if shuzu(m) > shuzu (n) then
t = shuzu(m)
shuzu(m) = shuzu(n)
shuzu(n) = t
end if
next
next
numgs = 0
for m = 2 to 7
if shuzu(m) = shuzu(m-1) then
numgs = numgs + 1
end if
next
if numgs = 2 then
hw.WriteLine nnum
end if
next
next
next
next
next
next
next
hw.Close
MsgBox "完成"
Wscript.Quit
'代码结束
全部回答
- 1楼网友:空虚的心
- 2021-02-25 12:20
你好!
有1640625种可能
用EXCEL求解的话
在EXCEL里输入=COMBIn(7,5)*5^7
7个数里取5个数 有21种可能,
5个数字排列 有 5的7次方 种可能
打字不易,采纳哦!
- 2楼网友:陪我去流浪
- 2021-02-25 10:57
楼上说得不错
补习一下统计学知识就能算出来
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!