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

How many such routes are there through a 2020 grid?

题目大意:

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

对于2020的网格,这样的路有多少条?

// (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

(Problem 15)Lattice paths的更多相关文章

  1. (Problem 42)Coded triangle numbers

    The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangl ...

  2. (Problem 46)Goldbach's other conjecture

    It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a ...

  3. (Problem 49)Prime permutations

    The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

  4. (Problem 47)Distinct primes factors

    The first two consecutive numbers to have two distinct prime factors are: 14 = 2  7 15 = 3  5 The fi ...

  5. (Problem 29)Distinct powers

    Consider all integer combinations ofabfor 2a5 and 2b5: 22=4, 23=8, 24=16, 25=32 32=9, 33=27, 34=81, ...

  6. (Problem 28)Number spiral diagonals

    Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is forme ...

  7. (Problem 22)Names scores

    Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-tho ...

  8. (Problem 16)Power digit sum

    215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of th ...

  9. (Problem 73)Counting fractions in a range

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

随机推荐

  1. 在原有3306端口mysqld服务的情况再搭建第二个3308端口的mysql实例

    1 download the tar.gz [root@472322 tmp]# wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6 ...

  2. C++头文件的包含顺序研究

    一.<Google C++ 编程风格指南>里的观点 公司在推行编码规范,领导提议基本上使用<Google C++ 编程风格指南>.其中<Google C++ 编程风格指南 ...

  3. C# Windows Sockets (Winsock) 接口 (转)

    在.Net中,System.Net.Sockets 命名空间为需要严密控制网络访问的开发人员提供了 Windows Sockets (Winsock) 接口的托管实现.System.Net 命名空间中 ...

  4. 数据科学家:神话 &amp; 超能力持有者

    一个打破神话的季节,正在降临.        我将坦诚地揭穿人们关于数据科学家所持有的惯有看法.在下文中,我将一个一个展示这些观点,宛如将一个又一个的玻璃瓶子摔碎在墙壁上一样.        关于数据 ...

  5. 图像检索:一维直方图+EMD距离

    EMD距离具体介绍已经在在这里已经给出. 思路:我们把一张图像的归一化的一维直方图作为signature的权值,也就是一般在比較两幅图像颜色直方图的EMD距离时,每一行的坐标一样,仅仅是权重值不一样. ...

  6. oracle 分组后取每组第一条数据

    ‘数据格式 分组取第一条的效果 sql SELECT * FROM (SELECT ROW_NUMBER() OVER(PARTITION BY x ORDER BY y DESC) rn, test ...

  7. hdu5115 Dire Wolf【区间dp】

    转载请注明出处,谢谢:http://www.cnblogs.com/KirisameMarisa/p/4361169.html   ---by 墨染之樱花 [题目链接]http://acm.hdu.e ...

  8. Ext JS学习第三天 我们所熟悉的javascript(二)

    •javascript之函数 •对于Ext开发者,我还是希望你能对javascript原生的东西非常了解.甚至熟练掌握运用.那么函数,无疑是非常重要的概念.首先在前面一讲,我们知道了函数也是一种数据类 ...

  9. 基础算法-查找:线性索引查找(II)

    索引查找是在索引表和主表(即线性表的索引存储结构)上进行的查找. 索引查找的过程是: 1)首先根据给定的索引值K1,在索引表上查找出索引值等于K1的索引项,以确定对应子表在主表中的开始位置和长度. 2 ...

  10. MongoDB Linux下的安装和启动(转)

    1. 下载MongoDB,此处下载的版本是:mongodb-linux-i686-1.8.1.tgz.tar. http://fastdl.mongodb.org/linux/mongodb-linu ...