一切福田,不離方寸,從心而覓,感無不通。

顺序求出c(n,r)的排列组合

using System; namespace combinaton{ /// <summary> /// Summary description for Class1. /// </summary> class Class1 {  /// <summary>  /// The main entry point for the application.  /// </summary>  [STAThread]  static void Main(string[] args)  {   //   // TODO: Add code to start application here   //   Console.WriteLine("please input n :");   long n=long.Parse(Console.ReadLine());   Console.WriteLine("please input r :");   long r=long.Parse(Console.ReadLine());   combinaton(n,r);   Console.ReadLine();  }  static void combinaton(long n,long r)  {   if(n<r)   {    long temp;    temp=n;    n=r;    r=temp;   }   long[] s=new long[n];   long count = combi(n,r);   Console.WriteLine("there are total:{0}count:",count);   for(long i=0;i<r;i++)   {    s[i]=i+1;    Console.Write("{0}",s[i]);   }   Console.WriteLine();   for(long i=1;i<count;i++)   {    […]

龙生   05 Aug 2010
View Details