Skip to content

speedlimit

bradendubois edited this page Nov 24, 2021 · 8 revisions

Speed Limit

ID: speedlimit

Difficulty: 1.5

CPU Time: 1 second

Memory: 1024 MB

Solution

This one is trivial; have a total of miles driven initialized to 0, and read in each line for a set, tracking the "previous time", and simply add s * (t - prev (initialized to 0)) and update prev to the current time, repeat for each set.

Clone this wiki locally