The Cheapest Way


The Cheapest Way

§The weight of a pate is the sum of the integers in each of the n cells of the matrix that are visited. §The minimum paths through two slightly different 5X6 matrices are shown below.§The matrix values differ only in the bottom row. The path for the matrix on the right takes advantage of the adjacency between the first and last rows.Input§The input consists of a sequence of matrix specifications. Each matrix consists of the row and column dimensions on a line, denoted m and n, respectively.§This is followed by m×n integers, appearing in row major order; i.e., the first n integers constitute th..........



원문링크 : The Cheapest Way