编程介的小学生 2017-09-06 00:36 采纳率: 20.5%
浏览 860
已采纳

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条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序