Lattice paths

Problem 15

Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.

p_015.gif

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

格子路

问题 15

从一个 2×2 表格中的左上角开始, 只能向右或向左,共有6条路可以到达右下角。

p_015.gif

那么通过一个20×20的表格有多少条路?

问题分析

在2×2的表格中,为了达到右下角,需要向右移动2次,向下移动2次,运用排列组合可以很简单的解决这题。设有4个球,2个红球,2个黑球,进行排列,求有多少种不同的排列方法,4个球的排序共有4!种不同的排列,因为同种颜色球交换位置实际上是一种排列,所以要剔除这种多余的排列,最终答案为4!/(2!*2!)。同理,20*20的结果为40!/(20!*20!)计算时,因为40!的值过大,所以可以先手动化简。或者采用编程方法解决。