Programming algo

You are going on a long horse trip. You start on the road at mile post 0. Along the way there are n horse stations at mile posts m1 < m2 < ..< mn where each mi is measured from the starting point. The only places you are allowed to stop and change horses are at these stations, but you can chose which of the stations you stop at. You must stop at the final station(at distance mn) which is your destination.
Assume that at a station it takes 2 hours to change horses and a horse takes x^2/400 hours to travel x miles. Design a dynamic programming algorithm to determine a sequence of stations at which to stop so as to minimize the total hours.


any solution which can help me??
thanks
Where is your code? We aren't going to write it for you.
i dont have code written..i just want some basic idea. and i dont want the code but just want the algo..
I spot a pattern:

http://cplusplus.com/forum/general/30842/
http://cplusplus.com/forum/general/30843/


This isn't a homework service, tantel. Posting your homework problems and expecting people to reply with solutions is a waste of everyone's time.

We don't mind helping if you're having trouble, but you need to show us you made a genuine effort to figure it out yourself.
Topic archived. No new replies allowed.