(Problem 15)Lattice paths
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的更多相关文章
- (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 ...
- (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 ...
- (Problem 49)Prime permutations
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...
- (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 ...
- (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, ...
- (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 ...
- (Problem 22)Names scores
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-tho ...
- (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 ...
- (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 ...
随机推荐
- grunt切换下载源
nrm 是一个 NPM 源管理器,允许你快速地在NPM 源间切换: 安装:npm install -g nrm 列出可选源:nrm ls 切换:nrm use taobao 测试所有源连接时间:nrm ...
- FPGA知识大梳理(四)FPGA中的复位系统大汇总
本文整合特权(吴厚航)和coyoo(王敏志)两位大神的博文.我也很推崇这两位大神的书籍,特权的书籍要偏基础一下,大家不要一听我这么说就想买coyoo的.我还是那一句话,做技术就要step by ste ...
- 输出1到最大的N位数
题目:输入数字n,按顺序输出从1最大的n位10进制数.比如输入3,则输出1.2.3一直到最大的3位数即999. 分析:这是一道很有意思的题目.看起来很简单,其实里面却有不少的玄机. 应聘者在解决这个问 ...
- HDU 3486 Interviewe
题目大意:给定n个数的序列,让我们找前面k个区间的最大值之和,每个区间长度为n/k,如果有剩余的区间长度不足n/k则无视之.现在让我们找最小的k使得和严格大于m. 题解:二分k,然后求RMQ检验. S ...
- DRP过后,感受知识间的通性
DRP视频看了不短的时间,真正开始DRP的时间是7月17号,至今两个月了.由于暑假期间英语的学习占得时间比较多,所以DRP视频进行的很慢.9月11号看完了DRP所有的视频,这个项目完成后最大的感受是: ...
- java软件工程师成长过程的学习
第一阶段:Java基础,包括java语法,面向对象特征,常见API,集合框架: *第二阶段:java界面编程,包括AWT,事件机制,SWING,这个部分也可以跳过,用的时候再看都能来及: *第三阶段: ...
- android经常使用的电话操作
给大家分享一下我的一个Android工具类,能够获取手机里面的各种信息,包含拨打电话. 获取全部联系人姓名及电话,插入联系人姓名及电话,插入联系人姓名及电话.插入通话记录.获取用户全部短信.批量插入短 ...
- HDU4712+随机算法
随机算法 求n个20位的2进制串的MinDist. Dist:两个串的异或结果中1的个数 /* 随机算法 */ #include<algorithm> #include<iostre ...
- No.3小白的HTML+CSS心得篇
A--看的东西多了总会出现好多模糊不清的又长的很像的的词语 今天对此进行区别分析下 1. align 与 text-align的区别 align 在W3Cschool中是这样解释的 ----alig ...
- Implement custom foreach function in C#
http://msdn.microsoft.com/en-us/library/System.Collections.IEnumerator.aspx http://support.microsoft ...