题解 | #走方格的方案数#
走方格的方案数
http://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
#include <stdio.h>
#include <string.h>
//一共走了m+n步 向下n,向右m
int fact(int n);
int main()
{
    int m, n;
    while (scanf("%d %d", &m, &n) != EOF)
    {
        int pathcount = 0;
        pathcount = fact(m + n) / (fact(m) * fact(n));
        printf("%d\n", pathcount);
    }
    return 0;
}
int fact(int n)
{
    int ret = 1;
    while (n >= 1)
    {
        ret *= n;
        n--;
    }
    return ret;
}


查看9道真题和解析