#C2692. Minimum Strength Path
Minimum Strength Path
Minimum Strength Path
You are given a square grid of size (n\times n) where each cell contains a positive integer representing the strength required to pass through that cell. Your task is to determine the minimum total strength required to travel from the top-left corner to the bottom-right corner of the grid. You can only move either right or down at any step. The total strength required is the sum of all cells along the path (including the starting and ending cells).
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer (n), the size of the grid.
- The following (n) lines each contain (n) space-separated positive integers representing the grid.
outputFormat
Output a single integer which is the minimum total strength required to travel from the top-left corner to the bottom-right corner of the grid.## sample
3
1 1 1
1 100 1
1 1 1
5