#11850 - AlaskaSolved By: | wesley | Theory Difficulty: | trivial | Coding Difficulty: | trivial | Algorithms Used: | simulation
| Solution Description: | Make an array of 1423 booleans, and mark which locations have recharge stations. Then, simply simulate the drive. Every mile you drive, decrement a gas counter, and if you arrive at a location with a recharge station, set the gas counter to 200. If at any point you have 0 gas, then your trip fails.
Don't forget that you have to make your way *back* as well. Just because you made it there doesn't mean you have enough energy for the return trip. |
Copyright 2008 (c) QuestToSolve.Com - Graphs Powered By
|