110,500
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication8
{
class Program
{
public void fun(int min, int max,string a)
{
if (min == 0)
{
fun1(max, a);
}
else
{
for (int i = min; i <= max; i++)
fun1(i, a);
}
}
private void fun1(int p,string a)
{
string b;
if (p == 1)
{
for (int i1 = 0; i1 < 13; i1++)
{
b = a.Substring(i1, 1);
Console.WriteLine("{0}", b);
}
}
if (p == 2)
{
for (int i1 = 0; i1 < 13; i1++)
{
for (int i2 = 0; i2 < 13; i2++)
{
b = a.Substring(i1, 1)+a.Substring(i2,1);
Console.WriteLine("{0}", b);
}
}
}
if (p == 3)
{
for (int i1 = 0; i1 < 13; i1++)
{
for (int i2 = 0; i2 < 13; i2++)
{
for (int i3 = 0; i3 < 13; i3++)
{
b = a.Substring(i1, 1) + a.Substring(i2, 1) + a.Substring(i3, 1);
Console.WriteLine("{0}", b);
}
}
}
}
.......
if (p == 13)
{
}
}
static void Main(string[] args)
{
string a = "1234567abcdef";
Program g = new Program();
g.fun(1, 3, a);
Console.ReadKey();
}
}
}