#C1166. Counting Grid Paths
Counting Grid Paths
Counting Grid Paths
Given an m x n grid, your task is to determine the number of unique paths from the top-left corner to the bottom-right corner. You are only allowed to move either right or down at any point in time.
The number of such paths is given by the binomial coefficient:
\( \displaystyle \binom{m+n-2}{m-1} \)
For example, when m = 3 and n = 3, the number of paths is 6.
inputFormat
The input consists of a single line containing two space-separated integers m and n (1 ≤ m, n ≤ 103), representing the number of rows and columns of the grid, respectively.
outputFormat
Output a single integer representing the number of distinct paths from the top-left to the bottom-right corner.
## sample2 2
2