HBC223594黑妹的游戏II,动态规划EJustPassingThrough题解 (justinandfredaaretakingaroadtrip)

一座城两个人 算法基础篇 33 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Justin and Fred are taking a road trip, traveling from West to East across their state. They have a few Road Trip Rules: 1. They must have an awesome time!Because Justin and Fred are traveling Eastward, a “pass” is any location with strictly lower elevations to its East and West and strictly higher elevations to its North and South. Consider the elevation map shown in Figure E.1. Undrivable locations are shown in black, while passes are shown as gray. Locations adjacent to the border or to undrivable locations are not eligible for considerations as passes. Figure E.1: A sample elevation map

Justin and Fred are taking a road trip, traveling from West to East across their state. They have a few Road Trip Rules:  1. They must have an awesome time!  2. The trip must begin somewhere along the Western edge of the state and finish somewhere along the Eastern edge of the state.  3. Each step in their trip must move them either directly East, diagonally Northeast, or diagonally Southeast.  4. They want to travel through exactly n “passes” (defined below). 5. Due to Fred’s sensitivity to higher elevations, they wish to minimize the cumulative sum of elevations during the trip.  6. They must have an awesome time!  Because Justin and Fred are traveling Eastward, a “pass” is any location with strictly lower elevations to its East and West and strictly higher elevations to its North and South. Consider the elevation map shown in Figure E.1. Undrivable locations (either due to water or stubborn insistence on staying in-state) are shown in black, while passes are shown as gray. Locations adjacent to the border or to undrivable locations are not eligible for considerations as passes. Figure E.1: A sample elevation map 

成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC223594黑妹的游戏II 动态规划EJustPassingThrough题解