Paths on a Grid (数学)

#include <stdio.h>
__int64 C(__int64 a,__int64 b)
{
    if(b==0)
        return 1;
    else if(b==1)
        return a;
    else
        return C(a-1,b-1)*a/b;
}
int main()
{
    __int64 n,m;
    while(scanf("%I64d%I64d",&n,&m)!=EOF && (n||m) )
        printf("%I64d\n",C(n+m,n<m?n:m));        //C(m+n,n)=  C(m+n,m)
    return 0;
}

Paths on a Grid (数学)

上一篇:JQ---h5页面上实现微信扫一扫功能


下一篇:HDU 1133 Buy the Ticket