#C11653. ISS Navigation
ISS Navigation
ISS Navigation
The International Space Station (ISS) must navigate through a grid in space while avoiding debris. It starts at the bottom-left corner (1, 1) and needs to reach the top-right corner (n, m). However, the ISS is restricted to moving only up or right at any point in time.
Your task is to compute the number of distinct paths the ISS can take to reach its destination. Mathematically, the number of paths can be expressed using the binomial coefficient:
$$ \binom{n+m-2}{n-1} \; .$$
Although you might use a combinatorial formula, you are advised to implement an efficient dynamic programming solution.
inputFormat
The input consists of two space-separated integers n and m on a single line, where n denotes the number of rows and m denotes the number of columns in the grid.
outputFormat
Output a single integer representing the number of distinct paths available from the bottom-left corner to the top-right corner of the grid.## sample
3 3
6