Quadratic Autopilot

Thomas is trying to model airplanes in his 3D modeling program. He has decided to use parabolic curves to model the movement paths of airplanes. To make his curves as accurate as possible, he has asked a few of his pilot friends to give him the elevations of their respective airplanes at three points in time during some of their flights. Using these three points of elevation data from a given flight, help Thomas find the integer constants $a$, $b$, and $c$ in the equation

\begin{equation*} e(t) = at^2 + bt + c \end{equation*}

which gives the elevation of an airplane at time $t$.


The input consists of three lines, each with two integers separated by a single space. The first integer on a line is a time, $t$, and the second integer is the elevation at time $t$: $e(t)$. The times will appear in order from smallest to greatest; i.e. $t_1 < t_2 < t_3$.

Input Restrictions

  • $0 \leq t,e(t) < \left\lfloor \sqrt{2^{32-1}-1} \right\rfloor $


The output should be a single line with the three integers $a$, $b$, and $c$ satisfying the above equation, separated by spaces.

Sample Input 1 Sample Output 1
0 5280
10 12780
25 14655
-25 1000 5280
CPU Time limit 1 second
Memory limit 1024 MB
David Florness
Source [email protected] High School Programming Competition 2021
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in