当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ASP.NET教程:多个Set排列算法

ASP.NET
如何使用vb6.0来实现中文实名搜索
C#实现Window管道技术
记录下一些关于测试工具NUNIT的链接资料,有兴趣的朋友也可以跳过去看看
编写与.NET属性窗口交互的RAD组件(自序)
asp.net 关于form认证的一般设置:
编写与.NET属性窗口交互的RAD组件(一)
ActiveX控件的打包发布[无证书发布](一)
Visual SourceSafe 6.0 的问题思考
VB报表输出的问题,恳请不吝赐教
证书和签名--试用微软提供的证书测试工具系列
[dotNET]如何利用ConfigurationSettings.AppSettings.GetValues读取配置文件中多个...
使用C#编写DES加密程序的framework
令你的网页速度大大提高
怎样得到一个系统盘的全名,不是字符,是全名,如:本地磁盘(C:)?
r在richtextbox中插入动画/控件
Code: Writing Text to a File (Visual Basic)
算法讨论:哲学家就餐问题
我们所要关注的是什么?
firebird 连接嵌入式版本
从Csharp走到VB.Net(一):MyClass保留字

ASP.NET教程:多个Set排列算法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 179 ::
收藏到网摘: n/a

using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
public class Test{
public static void Main(string [] args){
    string CheckDefault="A,B,C;D,E;G,F,J";
    string[] Lists=CheckDefault.Split(';');
    int MAXResult=1;
    int MAXColum=Lists.Length;
    List<string[]> c=new List<string[]>(MAXColum);
    for(int i=0;i< MAXColum;i++){
        c.Add(Lists[i].Split(','));
        MAXResult*=c[i].Length;
    }
    int[] k=new int[MAXColum];
    for(int i=0;i<MAXResult;i++){
        for(int j=0;j<MAXColum;j++){
            Console.Write( c[j][k[j]]+(j==MAXColum-1?"\r\n":""));
        }
        AddOne(c,ref k);
    }
    Console.WriteLine("总数是{0}",MAXResult);
}
public static void AddOne(List<string[]> c,ref int[] k){
    int zoomCol=k.Length-1;
    while(zoomCol>0 &&  k[zoomCol]+1 == c[zoomCol].Length){
        k[zoomCol]=0;
        zoomCol--;
    }
    k[zoomCol]+=1;
}
}