#C5465. Counting Paths in a Grid
Counting Paths in a Grid
Counting Paths in a Grid
You are given a grid with dimensions n x m (i.e. n rows and m columns). Your task is to compute the number of distinct paths from the top-left corner (0, 0) to the bottom-right corner (n, m) if you can move only right or down.
This problem can be solved using the binomial coefficient formula:
$$ \binom{n+m}{n} $$
This coefficient counts the number of ways to choose when to move right (or down) among the total moves.
inputFormat
The input consists of two non-negative integers n and m separated by space or newline.
outputFormat
Output a single integer which represents the number of distinct paths from (0,0) to (n, m).
## sample2 2
6