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