(Problem 15)Lattice paths

时间:2021-10-03 08:51:51

Starting in the top left corner of a 2(Problem 15)Lattice paths2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.

(Problem 15)Lattice paths

How many such routes are there through a 20(Problem 15)Lattice paths20 grid?

题目大意:

从一个2(Problem 15)Lattice paths2网格的左上角开始,有6条(不允许往回走)通往右下角的路。

对于20(Problem 15)Lattice paths20的网格,这样的路有多少条?

// (Problem 15)Lattice paths
// Completed on Tue, 11 Feb 2014, 23:58
// Language: VC++2010
//
// 版权所有(C)acutus (mail: acutus@126.com)
// 博客地址:http://www.cnblogs.com/acutus/
#include<iostream>
#include<cmath>
using namespace std; long long a[][]; int main()
{
int i;
for(i = ; i < ; i++)
{
a[][i] = ;
a[i][] = ;
}
for (i = ; i < ; i++)
for (int j = ; j < ; j++)
a[i][j] = a[i][j-] + a[i-][j];
cout<<a[][]<<endl;
return ;
}
Answer:
137846528820