Editorial for LCC/Moose '19 Contest 1 J2 - A Car Problem


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Riolku

This is a simple algebra problem.

First, let the speed of your car be  S . Now, you want to find  S .

Since your friend's car is  X km/h slower, it travels at  S - X km/h.

Now  X ,  N ,  T and  S are given by the following equation:

\displaystyle  N = T \times (S + (S - X))

If we solve for  S , we get:

\displaystyle  S = \frac{\frac{N}{T} + X}{2}

Now you can simply print out  S given  N ,  X and  T .


Comments

There are no comments at the moment.