[C#] 纯文本查看 复制代码
float[] arr = new float[3];
for (int i = 0; i < arr.Length; i++)
{
arr = i + 1;
}
//求排列
List<float[]> lst_Permutation = PermutationAndCombination<float>.GetPermutation(arr,3);
//其中
List<float[]> lst_Combination = PermutationAndCombination<float>.GetCombination(arr, 2);
Console.WriteLine("排列:");
int icount = 1;
foreach (float[] array in lst_Permutation)
{
Console.Write("排列1" + icount++ + "-->");
foreach (float itemp in array)
{
Console.Write(itemp.ToString() + ",");
}
Console.WriteLine();
}
Console.WriteLine("组合:");
icount = 1;
foreach (float[] array in lst_Combination)
{
Console.Write("组合1" + icount++ + "-->");
foreach (float itemp in array)
{
Console.Write(itemp.ToString() + ",");
}
Console.WriteLine();
}
Console.ReadKey();