HBC202121Cave Escape题解

素流年 算法基础篇 52 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
N from top to buttom, and columns are numbered from. M from left to right. The cell at the i-th row and the j-th column is denoted by. ), and the exit of the save is located at the cell. Each cell in this cave contains a number, which is called the magic value. The magic value of cell. When Bob moves from one cell to an unvisited cell, he gains energy points equals to the product of two magic values. It means, if Bob moves from cell. Bob can move between cells that share an edge . On the exit cell, Bob can choose not to exit the cave and continue to explore the cave if he want to. Can you help him find the maximum number of energy points he can gain when he exits the cave.

Bob is stuck in a cave represented by a matrix of mathbf{N} N rows and mathbf{M} M columns, where rows are numbered from mathbf{1} 1 to mathbf{N} N from top to buttom, and columns are numbered from mathbf{1} 1 to mathbf{M} M from left to right. The cell at the i-th row and the j-th column is denoted by {(i, j)} (i,j). Bob is currently at the cell (mathbf{S_R}, mathbf{S_C}) (S R ​ ,S C ​ ), and the exit of the save is located at the cell (mathbf{T_R}, mathbf{T_C}) (T R ​ ,T C ​ ). Each cell in this cave contains a number, which is called the magic value. The magic value of cell {(i, j)} (i,j) is mathbf{V_{ij}} V ij ​ . When Bob moves from one cell to an unvisited cell, he gains energy points equals to the product of two magic values. It means, if Bob moves from cell {(i, j)} (i,j) to cell {(x, y)} (x,y), and cell (x, y) is unvisited, he will gain mathbf{V_{ij} times V_{xy}} V ij ​ ×V xy ​ energy points. Bob can move between cells that share an edge (not just a corner). On the exit cell, Bob can choose not to exit the cave and continue to explore the cave if he want to. Can you help him find the maximum number of energy points he can gain when he exits the cave.

HBC202121Cave Escape题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC202121Cave Escape题解