2002 Canadian Computing Competition, Stage 2
Day 2, Problem 3: 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 stops 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 [seconds] of the car on an empty tank (float)
- the increase in lap time [seconds] per litre of fuel carried at the beginning of the lap (float)
- the theoretical fuel consumption [litres per lap] on an empty tank (float)
- the increase in fuel consumption per litre 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 litre 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 3 decimal places. All numbers on a single line should be separated by a single space.
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.000 0.000 10.000 0.000 20.000 0.000
300.000 30.000 0
3 100.000 0.000 10.000 0.100 20.000 0.000
300.000 37.174 0
3 100.000 2.000 10.000 0.000 20.000 1.000
410.000 20.000 1
2 10.000
3 100.000 4.000 10.000 0.000 20.000 1.000
480.000 10.000 2
1 10.000
2 10.000
3 100.000 2.000 10.000 0.1000 20.000 1.000
422.469 23.457 1
2 11.111
All Submissions
Best Solutions
Point Value: 20
Time Limit: 2.00s
Memory Limit: 16M
Added: Apr 18, 2009
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
It's quiet in here...