#K33227. Unique Paths in a Grid

    ID: 25041 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

You are given a grid of size m x n. You can only move either down or right at any point in time. Your task is to compute the number of unique paths from the top-left corner to the bottom-right corner of the grid. The answer can also be computed using the combinatorial formula: \( \binom{m+n-2}{m-1} \).

inputFormat

The input is read from stdin and consists of two positive integers m and n separated by space or newline.

outputFormat

Output to stdout a single integer, which is the number of unique paths from the top-left corner to the bottom-right corner of the grid.## sample

3 7
28