\[Пусть\ x\ \frac{км}{ч}\ и\ y\frac{км}{ч} - скорости\ \]
\[поездов.\]
\[Составим\ систему\ уравнений:\]
\[\left\{ \begin{matrix} \frac{240}{y} - \frac{240}{x} = 1 \\ 2y - x = 40\ \ \ \ \ \\ \end{matrix} \right.\ \text{\ \ \ \ \ \ \ \ }\]
\[\left\{ \begin{matrix} 240x - 240y - xy = 0 \\ x = 2y - 40\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \end{matrix} \right.\ \]
\[240 \cdot (2y - 40) - 240y - y(2y - 40) = 0\]
\[480y - 9600 - 240y - 2y^{2} + 40y =\]
\[= 0\ \ \ |\ :( - 2)\]
\[y^{2} - 140y + 4800 = 0\]
\[y_{1} + y_{2} = 140;\ \ \ \ y_{1} \cdot y_{2} = 4800\]
\[y_{1} = 60;\ \ \ y_{2} = 80.\]
\[\left\{ \begin{matrix} y = 60 \\ x = 80 \\ \end{matrix} \right.\ \text{\ \ \ \ \ \ \ \ \ \ \ \ }\left\{ \begin{matrix} y = 80 \\ x = 60 \\ \end{matrix} \right.\ \]
\[Ответ:80\ \frac{км}{ч};60\frac{км}{ч}.\]