Train Travel Time on Bridge
E · easyP · Verified PYQmath
Problem
A train covers a total distance of 800 meters (400m track length + 400m bridge length). Given the speed of the train in km/hr, calculate the time taken to completely cross the bridge in seconds. Formula: Time (seconds) = (Total Distance in metres / Speed in m/s) Convert km/hr to m/s by multiplying by (5/18).
Example
Input
72
Output
40
speed_ms = speed_kmh \* 5/18. time = 800 / speed_ms. Print as integer.
Speed = 72 \* 5/18 = 20 m/s. Time = 800/20 = 40 seconds.