I'm working on a problem for an online judge site. I've boiled down the problem to this calculation: given a vehicle with an initial velocity $v$, how can one calculate the minimum constant deceleration $a$ required to make sure the vehicle does not travel more than distance $d$ by time $t$? The constant deceleration is always applied until the vehicle either stops or reaches distance $d$. Stopping the vehicle at distance $d$ is allowed, if no other deceleration $a$ exists that slows the vehicle just enough so that it does not reach distance $d$ until time $t$. I tried starting with
\begin{equation} d = vt - \frac{at^2}{2} \end{equation}
and solving for $a$, giving $a = 2\frac{vt - d}{t^2}$ but that doesn't work by itself since it allows for the vehicle to extend past $d$ and return to it by going backwards (negative velocity), which violates the requirement that the vehicle not pass distance $d$ until time $t$.
So I applied $v = v_0 - at$ to calculate the maximum constant deceleration $a$ that produces non-negative final velocity at time $t$: $a \le \frac{v_0}{t}$. And if the calculation above exceeds this maximm deceleration then I apply the stopping distance deceleration formula: $a = \frac{v^2}{2d}$ (it's ok that this doesn't take exactly time $t$).
But my intuition tells me there should be some cases where the vehicle can be slowed without stopping it using constant deceleration over distance $d$, but I'm not seeing how to apply the suvat equations to do this. Maybe there is no way unless $\frac{v}{t} = 2\frac{vt - d}{t^2}$?