## CCO '02 P6 - Pit Stop Strategy

View as PDF

Points: 12
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Canadian Computing Competition: 2002 Stage 2, Day 2, Problem 3

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 Specification

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

• the number of laps in the race (integer less than or equal to )
• 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 )
• the time [seconds] for a pit stop taking on no fuel (float)
• the extra pit stop time per litre of fuel loaded (float)

#### Output Specification

For each input line, print the following information

• one line containing the seven input numbers in order
• one line containing three integers:
1. total race time
2. the amount of fuel to be loaded initially
3. the number of pit stops
• for each pit stop, a line containing:
1. the number of laps completed since the start of the race at the time of the pit stop
2. 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