#C645. Max Rooms to Visit in a Grid
Max Rooms to Visit in a Grid
Max Rooms to Visit in a Grid
You are given a grid with N rows and M columns. Starting from the top-left cell (0,0), you need to reach the bottom-right cell (N-1, M-1) by only moving either right or down. Each cell you pass through is considered a unique room.
The maximum number of rooms that can be visited is achieved by following a path that covers a new room at every step. This number is given by the formula: \(N + M - 1\).
Your task is to compute this number for a given grid.
inputFormat
The input consists of a single line containing two space-separated integers N and M, where N is the number of rows and M is the number of columns of the grid.
outputFormat
Output a single integer representing the maximum number of rooms that can be visited, which is computed using the formula \(N + M - 1\).
## sample1 1
1
</p>