How do I find minimum constant deceleration so that object does not pass distance d in time t? 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}$?
 A: Lets call your maximum time and distance to stop $T$ and $D$. If your vehicle is moving with speed $v_0$ and you apply a constant deceleration $a$, it will stop after a time $t = v_0 / a$, having traveled a distance $d=\frac{1}{2}v_0^2/a$.
Divide those two equations, and you can relate stopping time, distance and starting velocity as $d/t = v_0 / 2$, or $d = v_0 t / 2$.
You can have three different situations with your $T$, $D$ and $v_0$:


*

*if $D = v_0 T / 2$ then all works out nicely, and you can use any of the two formulas from the previous paragraph to calculate the acceleration that will have you stop at the right time and distance.

*if $D > v_0 T / 2$ then the acceleration that would have you stop at a distance $D$ is larger than the one that would have you atop after a time $T$, so you need to use the distance equation.

*if $D < v_0 T / 2$ then the opposite is true, and you need to use the time equation.


I think the above conditions can be summarized quite nicely in a $t-d$ graph, if you can't make sense of the above, let me know and I'll edit the answer to include it.
A: It turns out my approach was correct, but I had different errors preventing acceptance of my solution.   To summarize: 


*

*Calculate the maximum constant deceleration $a$ that can be applied for time $t$ that results in non-negative final velocity: $a_{max}=\frac{v_0}{t}$.   This is needed because the next equation does not take into account decleration that stops at velocity 0 (deceleration due to friction)

*Calculate the slowing (might be stopping) decleration that places the vehicle at distance $d$ at time $t$: $a_{slow} = 2\frac{v_0t-d}{t^2}$

*if $a_{slow} > a_{max}$, then applying $a_{slow}$ causes the vehicle to exceed distance $d$ before time $t$ (and to go "in reverse" back to $d$) -- use $a_{stop} = \frac{v_0^2}{2d}$, else use $a_{slow}$
Thanks to all who commented/answered
