(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 ...
随机推荐
- A Byte of Python 笔记(9) 面向对象编程
第11章 面向对象编程 面向过程:根据操作数据的函数或语句块来设计程序. 面向对象(OOP, object-oriented programming):把数据和功能结合起来,用对象包裹组织程序. 类 ...
- BootStrap学习1 输入提示
首先参考这个页面http://www.bootcss.com/javascript.html#typeahead 我只是把里面最基本的东西抠出来了 <!DOCTYPE html> < ...
- MFC消息截获之pretranslatemessage
前几天,查了一个batch的问题,问题大致是这样,父窗口消息一个鼠标消息,弹出一个模态框,CPU负荷就飚升到100%(双核就是50%),非常怪异,用windbg,分析哪个线程占用CPU,定位到鼠标响应 ...
- 17.1.2?Replication Formats 复制格式:
17.1.2?Replication Formats 复制格式: 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Ba ...
- 通过自定义window来实现提示框效果
#import <UIKit/UIKit.h>#import <Foundation/Foundation.h> @interface ZMStatuBarHud : NSOb ...
- PHP中用到的一些字符串函数
/*常用的字符串输出函数 * * echo() 输出字符串 * print() 输出一个或多个字符串 * die() 输出一条信息,并退出当前脚本 * printf() ...
- php:检测用户当前浏览器是否为IE浏览器
/** * 检测用户当前浏览器 * @return boolean 是否ie浏览器 */ function chk_ie_browser() { $userbrowser = $_SERVER['HT ...
- TexturePacker 介绍
TexturePacker这个词从字面来说就是Texture(纹理) + Packer(打包). 它是一款把若干资源图片拼接为一张大图的工具.它由一位叫做Andreas Loew的老外开发的 :). ...
- oracle修改数据库语言
alter session set nls_language = 'simplified chinese'; alter session set nls_language = 'american'; ...
- CentOS6.5安装Python2.7和Pip
注:文中所写的安装过程均在CentOS6.5 x86下通过测试,安装的Python版本为2.7.12,Pip版本为8.1.2 主要参考博文:http://bicofino.io/2014/01/16/ ...