Maze (permutations)

 

Problem Description

Garlic king went to the lower right corner from the top left corner of n rows and m columns maze, garlic monarch can only take one step to the right or downwards, garlic king wanted to know how many of his moves.

Input Format

Input two integers n (2≤n≤10 ^ 5), m (2≤m≤10 ^ 5).

Output Format

Because too few programs, outputs the final result of the modulo 1000000007 results.

Sample input

2
3

Sample Output

3

 

Maze n rows and m columns, come from the upper left bottom right, have to travel a total of n + m-2 steps, where n-1 is a step to go down, m-1 is to take the right steps
Possible way that there is C (n + m-2, n-1) Species
Operation is represented as a class
(n+m-2)! / (m-1)!*(n-1)!

 

 

 

 

 

-

Guess you like

Origin www.cnblogs.com/jiamian/p/12227339.html