SOJ.SubDiagonal Paths

13062. SubDiagonal Paths限制条件

时间限制: 1 秒, 内存限制: 256 兆

题目描述

You are to find all of the paths on the bottom diagonal of a n x n grid. The path must only go from lefttoright or bottomtotop. Given a dimension of the grid (ex. n = 4), specify the number of such paths (ex. solution = 14).

输入格式

The input consists of a single integer n, the dimension of the square grid, 1 <= n <= 30, on each line. A zero will indicate the end of the input and should not be processed.

输出格式

For each input n, you should output the number of paths, as described above, that exist in an nxn grid, one per line.

样例输入12340样例输出12514题目来源

2014年每周一赛第十五场暨“指点传媒杯”第六届中山大学ICPC新手赛模拟赛

卡特兰数存在递推公式a[i]=((4*i-2)/(i+1))*a(i-1)(i>1)

,于是夜莺会在黎明到来之前勇敢的将胸膛顶住蔷薇的刺,

SOJ.SubDiagonal Paths

相关文章:

你感兴趣的文章:

标签云: