Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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.
please help me with solving this algorithm
can be just an algo or a C program