HBC24225能量项链,模拟[USACO 2015 Ope S]Bessie's Birthday Buffet题解

不可一世的小女人 算法基础篇 44 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
For Bessie the cow’s birthday, Farmer John has given her free reign over one of his best fields to eat grass. The field is covered inNpatches of grass , conveniently numbered1…N, that each have a distinct quality value. If Bessie eats grass of qualityQ, she gainsQunits of energy. Each patch is connected to up to 10 neighboring patches via bi-directional paths, and it takes BessieEunits of energy to move between adjacent patches . Bessie can choose to start grazing in any patch she wishes, and she wants to stop grazing once she has accumulated a maximum amount of energy. Unfortunately, Bessie is a picky bovine, and once she eats grass of a certain quality, she’ll never eat grass at or below that quality level again!She is still happy to walk through patches without eating their grass; in fact, she might find it beneficial to walk through a patch of high-quality grass without eating it, only to return later for a tasty snack. Please help determine the maximum amount of energy Bessie can accumulate.

For Bessie the cow’s birthday, Farmer John has given her free reign over one of his best fields to eat grass. The field is covered in N patches of grass (1≤N≤1000), conveniently numbered 1…N, that each have a distinct quality value. If Bessie eats grass of quality Q, she gains Q units of energy. Each patch is connected to up to 10 neighboring patches via bi-directional paths, and it takes Bessie E units of energy to move between adjacent patches (1≤E≤1,000,000). Bessie can choose to start grazing in any patch she wishes, and she wants to stop grazing once she has accumulated a maximum amount of energy. Unfortunately, Bessie is a picky bovine, and once she eats grass of a certain quality, she’ll never eat grass at or below that quality level again! She is still happy to walk through patches without eating their grass; in fact, she might find it beneficial to walk through a patch of high-quality grass without eating it, only to return later for a tasty snack. Please help determine the maximum amount of energy Bessie can accumulate.

HBC24225能量项链,模拟[USACO 2015 Ope S]Bessie's Birthday Buffet题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC24225能量项链 模拟[USACO 2015 Ope S]Bessie's Birthday Buffet题解