Answer
$t=\frac{7s-33}{s^2-6s}$
Work Step by Step
Using $d=rt$, with a distance of $5$ miles and a speed of $s\text{ mi/h}$, the time, $t_1$, for the travel on the flat stretch is
$$\begin{aligned}
d&=rt
\\
5&=st_1
\\
t_1&=\frac{5}{s}
.\end{aligned}$$
With a distance of $1$ mile and the speed is doubled, then the time, $t_2$, for the travel down the hill is
$$\begin{aligned}
d&=rt
\\
1&=(2s)t_2
\\
t_2&=\frac{1}{2s}
.\end{aligned}$$
With a distance of $3$ miles and the downhill speed is reduced by $12\text{ mi/h}$, then the time, $t_3$, for the travel in the last part is
$$\begin{aligned}
d&=rt
\\
3&=(2s-12)t_3
\\
t_3&=\frac{3}{2s-12}
.\end{aligned}$$
Hence, the time, $t$, it takes for the rider to finish the race is
$$\begin{aligned}
t&=t_1+t_2+t_3
\\&=\frac{5}{s}+\frac{1}{2s}+\frac{3}{2s-12}
\\&=
\frac{7s-33}{s^2-6s}
.\end{aligned}$$Hence, the time it takes for the rider to finish the race is $t=\frac{7s-33}{s^2-6s}$. Using $f(s)=t$, then the function that gives the time to finish the race is
$$
t=\frac{7s-33}{s^2-6s}
.$$