You are given a list of roller coaster descriptions. Each description is a string in the format:
<CoasterType> <MaxSpeed> <BumpsPerSecond> <LiftType>
Examples:
-
"Wooden 4 2 Chain"
-
"Steel 20 0 Cable"
-
"Suspended 2 0.5 Cable"
For each coaster, compute an overall score using:
OverallScore = ScaleFactor * ComfortScore * MaxSpeed
The ScaleFactor and ComfortScore depend on the coaster type:
-
Wooden
-
ScaleFactor = 1.0
-
ComfortScore = min(1.0, 1.0 / BumpsPerSecond)
-
Steel
-
ScaleFactor = 2.0
-
ComfortScore = min(1.0, 5.0 / MaxSpeed)
-
Suspended
-
ScaleFactor = 0.5
-
ComfortScore = min(1.0, 1.0 / BumpsPerSecond) + LiftTypeBonus
-
LiftTypeBonus
is:
-
0.5
if
LiftType
is
Cable
-
0.1
if
LiftType
is
Launched
-
0.0
otherwise
Return a list of strings in the same order as the input, where each string is formatted as:
"Overall: <score>"
The score should be rounded to one decimal place.
Assume the input strings are well-formed, numeric fields can be parsed as floating-point values, and any denominator used by the relevant formula is nonzero.
Follow-up: design the solution so that adding new coaster types or changing scoring rules does not require modifying the core processing loop.