Description

給你一個 N×M 的棋盤

令左上角為 (1,1) ,右下角為 (N,M)

如果從 (1,1) 開始,只能往右或往下走

試問有幾種相異的走法可以走到 (N,M)

請將答案模 109+7 輸出

Input Format

N M

1N,M2000

Output Format

輸出一非負整數

Sample Input 1

2 2

Sample Output 1

2

Sample Input 2

2 3

Sample Output 2

3

Hints

image.png

範例測資2的圖形有以上三種走法

Subtasks

No. Testdata Range Score

TopCoder

807

User's AC Ratio

85.7% (30/35)

Tags

Problem Source

經典題 Path on Grid

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Memory Limit (RSS, KiB) Output Limit (KiB) Subtasks
0 1000 250000 250000 65536
1 1000 250000 250000 65536
2 1000 250000 250000 65536
3 1000 250000 250000 65536
4 1000 250000 250000 65536
5 1000 250000 250000 65536
6 1000 250000 250000 65536