dynamic programming - How does one solve this optimization? -


in videogame, there n levels, each 1 requires have amount of energy in order win level. start game @ level 0 0 energy, , every time win level, spend energy level requires (your energy can't go below 0). each level has 0, 1, or more shops sells energy amount e @ cost c. if find without enough energy pass level, lose because can't go previous levels buy other shops. whenever buy shop, new amount of energy e (the 1 shop sells), is, doesn't sum previous energy.

the question: minimum money necessary in order win n levels? (assuming money infinite , can buy shops want,... want optimize buys necessary)

i'm interested know how 1 finds solution this. problem solving technique solves kind of problems, if so, can explain?. there similar known problems should study first?

i tried using recursive backtracking, hope of finding overlapping states , use dynamic programming, didn't find them. states where: shops, fork 2 branches... buys shop, or doesn't.

this easy problem because energy doesn't sum. means energy e(n) after buying in level n not depend on did in levels 0...n-1. means can work backwards; last shops have bought energy reach end? , each of candidates, shops before them must have bought energy reach last shop?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -