编程介的小学生 2017-09-01 17:05 采纳率: 20.5%
浏览 825
已采纳

Pit Stop Strategy

The speed of a racing car, all other factors being equal, depends on the amount of fuel it carries. In general, the weight of the fuel slows the car. In addition, the weight of the fuel increases fuel consumption. It is therefore an advantage to carry as little fuel as possible. Any amount of fuel may be loaded at the beginning of the race, and refueling pit shops may be made during the race. The time consumed for the pit stop increases with the amount of fuel loaded. Your task is to determine the optimal fueling and pit stop strategy for each of a number of cars, based on measurements taken immediately before the race.

Input

Standard input consists of several lines of input, each containing:

the number of laps in the race (integer less than or equal to 100)
the theoretical lap time [second] of the car on an empty tank (float)
the increase in lap time (float) per liter of fuel carried at the beginning of the lap (float)
the theoretical fuel consumption [liters per lap] on an empty tank (float)
the increase in fuel consumption per liter of fuel carried at the beginning of the lap (float; strictly less than 1)
the time [seconds] for a pit stop taking on no fuel (float)
the extra pit stop time per liter of fuel loaded (float)

Output

For each input line, print the following information

one line containing the seven input numbers in order
one line containing three integers:
total race time
the amount of fuel to be loaded initially
the number of pit stops
for each pit stop, a line containing:
the number of laps completed since the start of the race at the time of the pit stop
the amount of fuel to be taken on
All floating point results should be printed to 6 significant figures. All numbers on a single line be separated by a single space.

If there are several optimal strategies, break the tie with an earlier pit stop.

Sample Input

3 100 0 10 0 20 0
3 100 0 10 .1 20 0
3 100 2 10 0 20 1
3 100 4 10 0 20 1
3 100 2 10 .1 20 1

Sample Output

3 100 0 10 0 20 0
300 30 0
3 100 0 10 0.1 20 0
300 37.1742 0
3 100 2 10 0 20 1
410 20 1
2 10
3 100 4 10 0 20 1
480 10 2
1 10
2 10
3 100 2 10 0.1 20 1
422.469 23.4568 1
2 11.1111

  • 写回答

1条回答

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)