Problem 15

问题描述:

Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner.



 

How many routes are there through a 20×20 grid?


 

解决问题:

运用排列组合的知识,问题就是

(m+n)!/(m!*n!)

可以运用动态规划递归解决

扫描二维码关注公众号,回复: 1346339 查看本文章
public static int find(int a, int b){
		if(a<0||b<0){
			return 0;
		}else if(a==0&&b==0){
			return 1;
		}else{
			return find(a-1,b) + find(a, b-1); 
		}
	}

但是运行。。。

所以需要转换为非递归的。。。

正在酝酿ing

猜你喜欢

转载自to-zoe-yang.iteye.com/blog/1151025
15