Question: Hard ( 9 0 points ) : Least gas. You have n gas stations with integer locations given at miles a 0 , a 1
Hard points: Least gas.
You have n gas stations with integer locations given at miles a a an on a straight road. It
requires $ to travel mile. Lets say we keep a house on this road with our car collection. Our
car collection also has n cars coincidentally. The th car in our collection travels to a The st car
travels to a and so on Please find the minimum amount of money that must be spent to have
each of our cars travel to their respective destinations. Note that you must choose the optimal
locations of the house in particular to minimize this distance. It is guaranteed that both answers
are small enough to fit in the long long datatype in C Fast solutions will get the extra credit
points.
Please print out a valid location for the house, and the minimum amount of money that can be
spent print both on separate lines
Hint : What is the solution if there are gas stations.
Hint : What is the solution if there are gas stations. in progaming in c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
