▍1. 一辆汽车加满油后可行驶n公里。旅途中有若干个加油站。设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少。对于给定的n和k个加油站位置,编程计算最少...
一辆汽车加满油后可行驶n公里。旅途中有若干个加油站。设计一个有效算法,指出应在哪些加油站停靠加油,使沿途加油次数最少。对于给定的n和k个加油站位置,编程计算最少加油次数。并证明算法能产生一个最优解-Fill up the car after driving an n km. There are a number of gas stations journey. Design an efficient algorithm that at which stations should stop to refuel along the way so that the least number of refueling. For a given n and k-station location, the calculation program for at least the number of refueling. And to prove that the algorithm can produce an optimal solution