标题:排列组合问题
只看楼主
day158
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-4-30
结帖率:0
已结贴  问题点数:20 回复次数:1 
排列组合问题
如下题:
甲乙丙丁戊己庚辛壬癸
子丑寅卯辰巳午未申酉戍亥

排列组合成:甲子,乙丑,丙寅,,,,,丙子,丁丑,戊寅,,,,,癸亥时的六十甲子组合

求解代码应如何写?
搜索更多相关主题的帖子: 如何 
2012-04-30 07:34
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1817
专家分:3681
注 册:2011-3-24
得分:20 
Dim Path1() as string
Dim Path2() as string
Dim Path3() as string
Dim i ,j, k as intxxx

Const String1="甲"
Const String2="子"

j=0
for i=0 to 10*i-1 setp (1 or 2)
    redim Pxxxx Path1(j)
    Path1(j)=Chr(Asc(String1)+i)    'i要看是1字节或2字节
    j=j+1
next i

j=0
for i=0 to 12*i-1 setp (1 or 2)
    redim Pxxxx Path2(j)
    Path2(j)=Chr(Asc(String2)+i)    'i要看是1字节或2字节
    j=j+1
next i

k=0
for i=0 to UBound(Path1)
    for j=0 to UBound(Path2)
        redim Pxxxx Path3(k)
        Path3(k)=Path1(i) & Path2(j)
        k=k+1
    next j
next i

猜大概是这感觉~

[ 本帖最后由 wube 于 2012-5-1 02:23 编辑 ]

不要選我當版主
2012-05-01 00:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-366743-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.106166 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved