求一个表格的最左上顶点到最右下顶点的路线数目
答案:组和数(n+m)!/(n!*m!)
nm = n+m;
product = 1;
while(n>0)
{
product *= nm/n;
nm--;
n--;
}
while(m>0)
{
product *= nm/m;
nm--;
n--;
}
while(nm>0)
{
product *= nm;
nm--;
}
void f(double nm, double n, double m)
{
if(n==0 || n==1) n = 1;
if(m==0 || m==1) m = 1;
if (nm == 1 || nm ==0) return 1;
else return (nm/n/m)*f(nm/n);
}