#K13506. Unique Synchronized Paths in a Grid
Unique Synchronized Paths in a Grid
Unique Synchronized Paths in a Grid
You are given an n x m grid. Two robots start synchronously from the top-left cell and must move to the bottom-right cell. At each step, a robot can either move right or down. The paths of both robots are synchronized, meaning that they take the same sequence of moves.
Your task is to calculate the number of unique synchronized paths available. This is equivalent to computing the number of distinct ways to move from the top-left to the bottom-right corner when only right and down moves are permitted.
Mathematically, the answer is given by the binomial coefficient: \[ C(n+m-2,\; n-1) = \frac{(n+m-2)!}{(n-1)! (m-1)!} \]
inputFormat
The input consists of a single line containing two positive integers n and m (1 ≤ n, m ≤ 100), separated by a space. These represent the number of rows and columns of the grid respectively.
outputFormat
Output a single integer, which is the number of unique synchronized paths from the top-left corner to the bottom-right corner of the grid.
## sample2 2
2