打印0-n的所有路径【原创】

  几天在论坛,看到这么个题目:
     
  打印0—N(0<=N<=9)的所有路径。
  想起以前那个工序最优解的解法,好像差不多,改一改,就ok了。
None.gif import  java.util.Stack;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/** */ /**
InBlock.gif * 
@author zxub Created on 2005-5-22 10:19:51
ExpandedBlockEnd.gif 
*/

None.gif
public   class  ProcessOpera
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif
InBlock.gif    
final int MAX = 20;
InBlock.gif    
// 保存路径信息的数组
InBlock.gif
    ProcessInfo process[] = new ProcessInfo[MAX];
InBlock.gif    
// 保存路径数目
InBlock.gif
    int numProcess = 0;
InBlock.gif    
// 分支路径栈
InBlock.gif
    Stack branchProcessStack = new Stack();
InBlock.gif    
// 用于搜索回退的栈
InBlock.gif
    Stack backTrackStack = new Stack();
InBlock.gif    
// 保存最后结果的栈
InBlock.gif
    Stack resultStack = new Stack();
InBlock.gif    
// 最长持续时间
InBlock.gif
    int maxLastingTime = 0;
InBlock.gif    
InBlock.gif    
private int sNode;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/** *//**
InBlock.gif     * 初始化所有路径信息,放进数组中
ExpandedSubBlockEnd.gif     
*/

InBlock.gif    
public void setup()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        addProcessInfo(
01);
InBlock.gif
InBlock.gif        addProcessInfo(
02);
InBlock.gif        addProcessInfo(
12);
InBlock.gif        addProcessInfo(
13);
InBlock.gif
InBlock.gif        addProcessInfo(
23);
InBlock.gif
InBlock.gif        addProcessInfo(
24);
InBlock.gif        addProcessInfo(
34);
InBlock.gif        addProcessInfo(
35);
InBlock.gif
InBlock.gif        addProcessInfo(
45);
InBlock.gif
InBlock.gif        addProcessInfo(
46);
InBlock.gif        addProcessInfo(
56);
InBlock.gif        addProcessInfo(
57);
InBlock.gif
InBlock.gif        addProcessInfo(
67);
InBlock.gif
InBlock.gif        addProcessInfo(
68);
InBlock.gif        addProcessInfo(
78);
InBlock.gif        addProcessInfo(
79);
InBlock.gif
InBlock.gif        addProcessInfo(
89);
ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/** *//**
InBlock.gif     * 增加路径信息到数组中
InBlock.gif     * 
InBlock.gif     * 
@param sNode
InBlock.gif     *            开始节点
InBlock.gif     * 
@param eNode
InBlock.gif     *            终止节点
InBlock.gif     * 
@param lTime
InBlock.gif     *            持续时间
ExpandedSubBlockEnd.gif     
*/

InBlock.gif    
public void addProcessInfo(int sNode, int eNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
if (numProcess < MAX) // 如果数组没满的话
ExpandedSubBlockStart.gifContractedSubBlock.gif
        dot.gif{
InBlock.gif            process[numProcess] 
= new ProcessInfo(sNode, eNode);
InBlock.gif            numProcess
++;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            System.out
InBlock.gif                .println(
"ProcessInfo database full!\nAdd error,program exit!");
InBlock.gif            System.exit(
0);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/** *//**
InBlock.gif     * 给所有路径信息中的附加属性赋值,要完成的话,需要遍历路径数组中的所有元素。 对于每个元素,要查看数组中的其它元素,确立关系
ExpandedSubBlockEnd.gif     
*/

InBlock.gif    
public void setNodeTag()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
for (int i = 0; i < numProcess; i++// 遍历路径数组中的所有元素,process[i]是选取的路径
ExpandedSubBlockStart.gifContractedSubBlock.gif
        dot.gif{
InBlock.gif            
for (int j = 0; j < numProcess; j++// 查看其它元素
ExpandedSubBlockStart.gifContractedSubBlock.gif
            dot.gif{
InBlock.gif                
if (i == j) continue// 自己比自己,没得比,继续下次循环
InBlock.gif                
// 发现有路径可以和选取路径连接
InBlock.gif
                if (process[j].endNode == process[i].startNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    process[i].hasFrontNode 
= true;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
// 两条不同路径的终结点一样
InBlock.gif
                if (process[j].endNode == process[i].endNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    process[i].eNodeIsBranchEndNode 
= true;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
// 两条不同路径的起始点一样
InBlock.gif
                if (process[j].startNode == process[i].startNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    process[i].sNodeIsBranchBeginNode 
= true;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/** *//**
InBlock.gif     * 找出以选取点为终结点的没走过的一条路径
InBlock.gif     * 
InBlock.gif     * 
@param eNode
InBlock.gif     *            所选取的点
InBlock.gif     * 
@return 没被走过的以选取点为终结点的一条路径
ExpandedSubBlockEnd.gif     
*/

InBlock.gif    
public ProcessInfo findProcessInfo(int eNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
for (int i = 0; i < numProcess; i++// 遍历路径信息
ExpandedSubBlockStart.gifContractedSubBlock.gif
        dot.gif{
InBlock.gif            
// process[i].skip=false 路径才没被走过
InBlock.gif
            if ((process[i].endNode == eNode) && (!process[i].skip))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
// 由于深度复制和浅度复制的问题,所以复制的时候要新建一个ProcessInfo,而不是引用原来
InBlock.gif                
// 这是实现问题,算法与此可以无关
InBlock.gif
                ProcessInfo pInfo = new ProcessInfo(process[i].startNode,
InBlock.gif                    process[i].endNode);
InBlock.gif                process[i].skip 
= true;
InBlock.gif                pInfo.hasFrontNode 
= process[i].hasFrontNode;
InBlock.gif                pInfo.eNodeIsBranchEndNode 
= process[i].eNodeIsBranchEndNode;
InBlock.gif                
return pInfo;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
return null// 没有合适的路径就返回null了
ExpandedSubBlockEnd.gif
    }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/** *//**
InBlock.gif     * 核心部分所在,查找任意2点间最长路径 基于AI设计,简单的AI 理论上来说,顺着找和倒着找是一样的,由于项目原因,这里我是倒着找的
InBlock.gif     * 查找到的路径放在结果栈resultStack中
InBlock.gif     * 
InBlock.gif     * 
@param sNode
InBlock.gif     *            开始节点
InBlock.gif     * 
@param eNode
InBlock.gif     *            终止节点
InBlock.gif     * 
@param depth
InBlock.gif     *            显示debug信息的时候用到,用于显示层次关系
ExpandedSubBlockEnd.gif     
*/

InBlock.gif    
public void searchProcess(int sNode, int eNode, int depth)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.sNode=sNode;
InBlock.gif        
InBlock.gif        ProcessInfo pInfo; 
// 保存路径信息的对象
InBlock.gif
        int numStartNode = 0// 查找起点的个数
InBlock.gif
        Stack resultTemp; // 保存查找到路径的临时栈
InBlock.gif
        while ((pInfo = findProcessInfo(eNode)) != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// 分支节点数目+1
InBlock.gif
            numStartNode++;
InBlock.gif            
// 将查找到的路径信息放到分支节点栈,然后再查
InBlock.gif
            branchProcessStack.push(pInfo);
InBlock.gif            showDebugInfo(
"分支路径栈加入:" + pInfo.startNode + "-->" + pInfo.endNode,
InBlock.gif                depth);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
if (numStartNode > 0// 有分支的话,如果这里不成立,整个就结束了
ExpandedSubBlockStart.gifContractedSubBlock.gif
        dot.gif{
InBlock.gif            
for (int i = 0; i < numStartNode; i++// 遍历分支节点栈
ExpandedSubBlockStart.gifContractedSubBlock.gif
            dot.gif{
InBlock.gif                pInfo 
= (ProcessInfo) branchProcessStack.pop(); // 获得一条分支路径
InBlock.gif
                showDebugInfo("分支路径栈弹出:" + pInfo.startNode + "-->"
InBlock.gif                        
+ pInfo.endNode, depth);
InBlock.gif                
// 为了防止头尾一样的路径,有了下面的判断,理论上是没有,但实际会出现
InBlock.gif
                if (pInfo.startNode == pInfo.endNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    showDebugInfo(
"头尾节点一样,丢弃!", depth + 1);
InBlock.gif                    
continue;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                
// 如果存在可到达的路径的话,注意,这是个递归过程
InBlock.gif
                if (pInfo.startNode == sNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
// 当前路径加入回退栈,此时,回退栈里可以找出一条完整的路径了
InBlock.gif
                    backTrackStack.push(pInfo);
InBlock.gif                    showDebugInfo(
"--------到达起点:" + pInfo.startNode + "-->"
InBlock.gif                            
+ pInfo.endNode + "--------", depth);
InBlock.gif                    
int numbackTrackStack = backTrackStack.size();
InBlock.gif                    resultTemp 
= new Stack();
InBlock.gif                    
for (int j = 0; j < numbackTrackStack; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        pInfo 
= (ProcessInfo) backTrackStack.get(j);
InBlock.gif                        showDebugInfo(
"回溯栈内容进入临时结果栈:" + pInfo.startNode + "-->"
InBlock.gif                                
+ pInfo.endNode, depth);
InBlock.gif                        resultTemp.push(pInfo);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    resultStack 
= resultTemp;
InBlock.gif                    showPath();
InBlock.gif                    
// 找出一条后,需要回退,然后继续找下一条
InBlock.gif                    
// 获得剩余分支路径的数目
InBlock.gif
                    int numBranch = branchProcessStack.size();
InBlock.gif
InBlock.gif                    
if (numBranch == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
// 没分支路径了,查找结束,清空回退栈
InBlock.gif
                        backTrackStack.removeAllElements();
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else if (numBranch > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
int index = numBranch - 1;
InBlock.gif                        
int backTrackValue = ((ProcessInfo) branchProcessStack
InBlock.gif                            .get(index)).endNode;
InBlock.gif                        showDebugInfo(
"--------回退到节点:" + backTrackValue
InBlock.gif                                
+ "--------", depth);
InBlock.gif                        
// 要回退到的节点必是分支路径栈中最上路径的尾节点
InBlock.gif                        
// 下面的循环就是一直回退,由于还有分支路径,所以可以找到要退到的点
InBlock.gif
                        do
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            pInfo 
= (ProcessInfo) backTrackStack.pop();
InBlock.gif                            showDebugInfo(
"找到目标,回溯栈回退到:" + pInfo.startNode
InBlock.gif                                    
+ "-->" + pInfo.endNode, depth);
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
while (pInfo.endNode != backTrackValue);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
// 回退后,继续查找的话,所有路径的经过标记都要重置,否则经过了的路径是不会再去查的
InBlock.gif                    
// 由于开始路径不同,所以不会找到同样的结果
InBlock.gif
                    resetAllSkip();
InBlock.gif                    
continue;// 开始从下个分支路径查找
ExpandedSubBlockEnd.gif
                }

InBlock.gif                
else
InBlock.gif                
// 没有直接从sNode到eNode的工序
ExpandedSubBlockStart.gifContractedSubBlock.gif
                dot.gif{
InBlock.gif                    
// 还没到目标
InBlock.gif                    
// 如果当前路径的起点还有前驱节点的话,需要递归查找,这是重点
InBlock.gif
                    if (pInfo.hasFrontNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        ProcessInfo btPInfo 
= new ProcessInfo(sNode, eNode);
InBlock.gif                        btPInfo.eNodeIsBranchEndNode 
= pInfo.eNodeIsBranchEndNode;
InBlock.gif                        
// 说明找过sNode-->eNode
InBlock.gif
                        backTrackStack.push(btPInfo);
InBlock.gif                        showDebugInfo(
"回溯栈加入:" + sNode + "-->" + eNode
InBlock.gif                                
+ ",说明找过" + sNode + "-->" + eNode, depth + 1);
InBlock.gif                        showDebugInfo(
"查找:" + sNode + "-->" + pInfo.startNode,
InBlock.gif                            depth 
+ 1);
InBlock.gif                        searchProcess(sNode, pInfo.startNode, depth 
+ 2);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
InBlock.gif                    
// 当前路径的起点无前驱,则路径错误,需要回溯
ExpandedSubBlockStart.gifContractedSubBlock.gif
                    dot.gif{
InBlock.gif                        
// 如果当前路径的终结点还有其它前驱的话,则退出本次循环,从下个分支路径查找
InBlock.gif
                        if (pInfo.eNodeIsBranchEndNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
continue;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
// 如果当前路径的终结点没有其它前驱,就要回退了
InBlock.gif
                        else if (backTrackStack.size() > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
// 开始回退,一直到找到个路径的终止节点有多个前驱为止,或者是回退栈已经空了。
InBlock.gif
                            do
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                pInfo 
= (ProcessInfo) backTrackStack.pop();
InBlock.gif                                showDebugInfo(
"路径错误,开始回溯,回溯栈弹出:"
InBlock.gif                                        
+ pInfo.startNode + "-->"
InBlock.gif                                        
+ pInfo.endNode, depth + 1);
ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
while ((!pInfo.eNodeIsBranchEndNode)
InBlock.gif                                    
&& (backTrackStack.size() > 0));
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            showDebugInfo(
"分支已被找遍", depth);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            showDebugInfo(
"前面已走过这条路径且被证明走不通,或尾节点没有前驱节点", depth);
InBlock.gif            
if (backTrackStack.size() > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                pInfo 
= (ProcessInfo) backTrackStack.pop();
InBlock.gif                showDebugInfo(
"路径不通,回溯栈弹出:" + pInfo.startNode + "-->"
InBlock.gif                        
+ pInfo.endNode, depth - 1);
InBlock.gif                
if (branchProcessStack.size() > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
int fixNode = ((ProcessInfo) branchProcessStack
InBlock.gif                        .lastElement()).endNode;
InBlock.gif                    
if (fixNode != pInfo.endNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        showDebugInfo(
"========需要调整回溯栈========", depth);
InBlock.gif                        showDebugInfo(
"========开始调整回溯栈========", depth);
InBlock.gif                        
do
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            pInfo 
= (ProcessInfo) backTrackStack.pop();
InBlock.gif                            showDebugInfo(
"回溯栈弹出:" + pInfo.startNode + "-->"
InBlock.gif                                    
+ pInfo.endNode, depth + 1);
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
while (fixNode != pInfo.endNode);
InBlock.gif                        showDebugInfo(
"========回溯栈调整结束========", depth);
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
private void showDebugInfo(String info, int blankCount)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
// String blank = "";
InBlock.gif        
// for (int i = 0; i < blankCount; i++)
InBlock.gif        
// {
InBlock.gif        
// blank += " ";
InBlock.gif        
// }
InBlock.gif        
// System.out.println(blank + info);
ExpandedSubBlockEnd.gif
    }

InBlock.gif
InBlock.gif    
public void showPath()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        ProcessInfo pInfo;
InBlock.gif        
int num = resultStack.size();
InBlock.gif        
if (num == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// showDebugInfo("========没有符合要求的路径========", 0);
ExpandedSubBlockEnd.gif
        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            System.out.print(
this.sNode);
InBlock.gif            
for (int i = 0; i < num; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                pInfo 
= (ProcessInfo) resultStack.pop();
InBlock.gif                System.out.print(
"-->" + pInfo.endNode);
ExpandedSubBlockEnd.gif            }

InBlock.gif            System.out.println();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public void resetAllSkip()
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
for (int i = 0; i < numProcess; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            process[i].skip 
= false;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public static void main(String[] args)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        ProcessOpera processOpera 
= new ProcessOpera();
InBlock.gif        processOpera.setup();
InBlock.gif        processOpera.setNodeTag();
InBlock.gif        
for (int i = 0; i <= 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            processOpera.resetAllSkip();
InBlock.gif            processOpera.searchProcess(
0, i, 0);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
//processOpera.searchProcess(0, 4, 0);
ExpandedSubBlockEnd.gif
    }

InBlock.gif
InBlock.gif    
public class ProcessInfo
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif
InBlock.gif        
// 基本信息:startNode,endNode
InBlock.gif
        protected int startNode; // 开始节点
InBlock.gif
        protected int endNode; // 终止节点
InBlock.gif
        protected int lastingTime; // 路径持续时间
InBlock.gif        
// 下面是附加信息,遍历的时候用到
InBlock.gif
        protected boolean skip; // 判断该路径是否已经走过
InBlock.gif
        protected boolean hasFrontNode; // 路径是否有前驱节点
InBlock.gif
        protected boolean eNodeIsBranchEndNode; // 路径终止节点是否有多个前驱
InBlock.gif
        protected boolean sNodeIsBranchBeginNode; // 路径开始节点是否有多个后继
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/** *//**
InBlock.gif         * 保存任意两点间路径信息
InBlock.gif         * 
InBlock.gif         * 
@param sNode
InBlock.gif         *            开始节点
InBlock.gif         * 
@param eNode
InBlock.gif         *            终止节点
InBlock.gif         * 
@param lTime
InBlock.gif         *            持续时间
ExpandedSubBlockEnd.gif         
*/

InBlock.gif        
public ProcessInfo(int sNode, int eNode)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.startNode = sNode;
InBlock.gif            
this.endNode = eNode;
InBlock.gif            
// 由于是刚开始保存,下面的几个信息不能确立,所以都是false
InBlock.gif
            this.skip = false;
InBlock.gif            
this.hasFrontNode = false;
InBlock.gif            
this.eNodeIsBranchEndNode = false;
InBlock.gif            
this.sNodeIsBranchBeginNode = false;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}
  答案如下:
0 --> 1
0 --> 1 --> 2
0 --> 2
0 --> 1 --> 2 --> 3
0 --> 2 --> 3
0 --> 1 --> 3
0 --> 1 --> 2 --> 3 --> 4
0 --> 2 --> 3 --> 4
0 --> 1 --> 3 --> 4
0 --> 1 --> 2 --> 4
0 --> 2 --> 4
0 --> 1 --> 2 --> 3 --> 4 --> 5
0 --> 2 --> 3 --> 4 --> 5
0 --> 1 --> 3 --> 4 --> 5
0 --> 1 --> 2 --> 4 --> 5
0 --> 2 --> 4 --> 5
0 --> 1 --> 2 --> 3 --> 5
0 --> 2 --> 3 --> 5
0 --> 1 --> 3 --> 5
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6
0 --> 2 --> 3 --> 4 --> 5 --> 6
0 --> 1 --> 3 --> 4 --> 5 --> 6
0 --> 1 --> 2 --> 4 --> 5 --> 6
0 --> 2 --> 4 --> 5 --> 6
0 --> 1 --> 2 --> 3 --> 5 --> 6
0 --> 2 --> 3 --> 5 --> 6
0 --> 1 --> 3 --> 5 --> 6
0 --> 1 --> 2 --> 3 --> 4 --> 6
0 --> 2 --> 3 --> 4 --> 6
0 --> 1 --> 3 --> 4 --> 6
0 --> 1 --> 2 --> 4 --> 6
0 --> 2 --> 4 --> 6
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 7
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 7
0 --> 2 --> 4 --> 5 --> 6 --> 7
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 7
0 --> 2 --> 3 --> 5 --> 6 --> 7
0 --> 1 --> 3 --> 5 --> 6 --> 7
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 7
0 --> 2 --> 3 --> 4 --> 6 --> 7
0 --> 1 --> 3 --> 4 --> 6 --> 7
0 --> 1 --> 2 --> 4 --> 6 --> 7
0 --> 2 --> 4 --> 6 --> 7
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 7
0 --> 2 --> 3 --> 4 --> 5 --> 7
0 --> 1 --> 3 --> 4 --> 5 --> 7
0 --> 1 --> 2 --> 4 --> 5 --> 7
0 --> 2 --> 4 --> 5 --> 7
0 --> 1 --> 2 --> 3 --> 5 --> 7
0 --> 2 --> 3 --> 5 --> 7
0 --> 1 --> 3 --> 5 --> 7
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 7 --> 8
0 --> 2 --> 4 --> 5 --> 6 --> 7 --> 8
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 7 --> 8
0 --> 2 --> 3 --> 5 --> 6 --> 7 --> 8
0 --> 1 --> 3 --> 5 --> 6 --> 7 --> 8
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 7 --> 8
0 --> 2 --> 3 --> 4 --> 6 --> 7 --> 8
0 --> 1 --> 3 --> 4 --> 6 --> 7 --> 8
0 --> 1 --> 2 --> 4 --> 6 --> 7 --> 8
0 --> 2 --> 4 --> 6 --> 7 --> 8
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 7 --> 8
0 --> 2 --> 3 --> 4 --> 5 --> 7 --> 8
0 --> 1 --> 3 --> 4 --> 5 --> 7 --> 8
0 --> 1 --> 2 --> 4 --> 5 --> 7 --> 8
0 --> 2 --> 4 --> 5 --> 7 --> 8
0 --> 1 --> 2 --> 3 --> 5 --> 7 --> 8
0 --> 2 --> 3 --> 5 --> 7 --> 8
0 --> 1 --> 3 --> 5 --> 7 --> 8
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 8
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 8
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 8
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 8
0 --> 2 --> 4 --> 5 --> 6 --> 8
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 8
0 --> 2 --> 3 --> 5 --> 6 --> 8
0 --> 1 --> 3 --> 5 --> 6 --> 8
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 8
0 --> 2 --> 3 --> 4 --> 6 --> 8
0 --> 1 --> 3 --> 4 --> 6 --> 8
0 --> 1 --> 2 --> 4 --> 6 --> 8
0 --> 2 --> 4 --> 6 --> 8
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 2 --> 4 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 2 --> 3 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 3 --> 5 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 7 --> 8 --> 9
0 --> 2 --> 3 --> 4 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 3 --> 4 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 4 --> 6 --> 7 --> 8 --> 9
0 --> 2 --> 4 --> 6 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 7 --> 8 --> 9
0 --> 2 --> 3 --> 4 --> 5 --> 7 --> 8 --> 9
0 --> 1 --> 3 --> 4 --> 5 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 4 --> 5 --> 7 --> 8 --> 9
0 --> 2 --> 4 --> 5 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 5 --> 7 --> 8 --> 9
0 --> 2 --> 3 --> 5 --> 7 --> 8 --> 9
0 --> 1 --> 3 --> 5 --> 7 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 8 --> 9
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 8 --> 9
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 8 --> 9
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 8 --> 9
0 --> 2 --> 4 --> 5 --> 6 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 8 --> 9
0 --> 2 --> 3 --> 5 --> 6 --> 8 --> 9
0 --> 1 --> 3 --> 5 --> 6 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 8 --> 9
0 --> 2 --> 3 --> 4 --> 6 --> 8 --> 9
0 --> 1 --> 3 --> 4 --> 6 --> 8 --> 9
0 --> 1 --> 2 --> 4 --> 6 --> 8 --> 9
0 --> 2 --> 4 --> 6 --> 8 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 9
0 --> 2 --> 3 --> 4 --> 5 --> 6 --> 7 --> 9
0 --> 1 --> 3 --> 4 --> 5 --> 6 --> 7 --> 9
0 --> 1 --> 2 --> 4 --> 5 --> 6 --> 7 --> 9
0 --> 2 --> 4 --> 5 --> 6 --> 7 --> 9
0 --> 1 --> 2 --> 3 --> 5 --> 6 --> 7 --> 9
0 --> 2 --> 3 --> 5 --> 6 --> 7 --> 9
0 --> 1 --> 3 --> 5 --> 6 --> 7 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 6 --> 7 --> 9
0 --> 2 --> 3 --> 4 --> 6 --> 7 --> 9
0 --> 1 --> 3 --> 4 --> 6 --> 7 --> 9
0 --> 1 --> 2 --> 4 --> 6 --> 7 --> 9
0 --> 2 --> 4 --> 6 --> 7 --> 9
0 --> 1 --> 2 --> 3 --> 4 --> 5 --> 7 --> 9
0 --> 2 --> 3 --> 4 --> 5 --> 7 --> 9
0 --> 1 --> 3 --> 4 --> 5 --> 7 --> 9
0 --> 1 --> 2 --> 4 --> 5 --> 7 --> 9
0 --> 2 --> 4 --> 5 --> 7 --> 9
0 --> 1 --> 2 --> 3 --> 5 --> 7 --> 9
0 --> 2 --> 3 --> 5 --> 7 --> 9
0 --> 1 --> 3 --> 5 --> 7 --> 9

  为做纪念,所以贴出来算了。

转载于:https://www.cnblogs.com/zxub/archive/2006/07/27/461163.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值