#C1975. Maximum Profit in a Grid
Maximum Profit in a Grid
Maximum Profit in a Grid
You are given a grid of size \(m \times n\) where each cell holds a profit value. Starting from the top-left corner, you can only move right or down. Your task is to determine the maximum profit that can be accumulated when moving to the bottom-right corner. This problem can be solved using dynamic programming to keep track of the maximum profit that can be obtained at each cell.
inputFormat
The input is read from standard input (stdin). The first line contains two integers (m) and (n), representing the number of rows and columns of the grid. Each of the following (m) lines contains (n) space-separated integers representing the profit values in each row of the grid.
outputFormat
Output a single integer to standard output (stdout) which indicates the maximum profit obtainable from the top-left to the bottom-right of the grid.## sample
1 1
5
5
</p>