62,025
社区成员
发帖
与我相关
我的任务
分享
static void Main(string[] args)
{
Permutate("1234", "", 0);
}
static void Permutate(string str, string result, int length)
{
if (str.Length == length)
{
Console.WriteLine(result);
}
for (int i = 0; i < str.Length; i++)
{
Permutate(str.Remove(i, 1), result + str[i], length);
}
}