Find the maximum value that the quantity $2m+7n$ can have 
Find the maximum value that the quantity $2m+7n$ can have such that there exist distinct positive integers $x_i$ $(1 \leq i \leq m)$, $y_j$ $(1 \leq j \leq n)$ such that the $x_i$'s are even, the $y_j$'s are odd, and $\displaystyle \sum_{i = 1}^m x_i+\sum_{j=1}^n y_j = 1986$.

We see that $\displaystyle \sum_{i = 1}^m x_i \geq 2+4+\cdots+m = \dfrac{(m+2)\frac{m}{2}}{2} = \dfrac{(m+2)m}{4}$ and $\displaystyle \sum_{j=1}^n y_j \geq n^2$. What do we do from here to maximize $2m+7n$?
 A: Your sum of the $x$'s is not correct.  You should have $\displaystyle \sum_{i = 1}^m x_i \geq 2+4+\cdots+2m = \dfrac{(2m+2)m}{2} = m(m+1)$  You must have $n$ even-why?  You are maximizing $2m+7n$ subject to $m(m+1)+n^2 \le 1986$.  Clearly we must have $n \le \lfloor \sqrt 1986 \rfloor=44$  The simple approach is to step $n$ down, assess the maximum $m$ for each one, and pick the best.  For a given $n$ you have $$m(m+1)+n^2 \le 1986\\ m(m+1) \le 1986-n^2\\ (m+\frac 12)^2 \le 1986\frac 14-n^2\\ m \le \sqrt{1986\frac 14-n^2}-\frac 12\\m=\left\lfloor \sqrt{1986\frac 14-n^2}-\frac 12\right\rfloor$$
A spreadsheet and copy down are your friend.
A: Alternatively, rewrite $m(m+1)+n^2\leq 1986$ as $(2m+1)^2+(2n)^2\leq 4\cdot 1986+1=7945$.  By the Cauchy-Schwarz Inequality,
$$\begin{align}
(2m+7n)+1=(2m+1)+\frac{7}{2}(2n)
&\leq \sqrt{1^2+\left(\frac{7}{2}\right)^2}\,\sqrt{(2m+1)^2+(2n)^2}
\\
&\leq\sqrt{\frac{53}{4}}\,\sqrt{7945}<325\,.
\end{align}$$
Thus, $$2m+7n<324\,.$$  The equality condition for equality case of the Cauchy-Schwarz Inequality is $\frac{2m+1}{1}=\frac{2n}{7/2}$ and $(2m+1)^2+(2n)^2=7945$, which gives
$$(m,n)=\frac{1}{106}\left(-53\pm 2\sqrt{421085},\pm7\sqrt{421085}\right)\,.$$
The closest positive-integer pair $(m,n)$ that obeys $(2m+1)^2+(2n)^2\leq 7945$ is $$(m,n)=(11,43)\,,$$ for which $2m+7n=323$.
