18 Let the sum of $m$ distinct positive even numbers and $n$ distinct positive odd numbers be 1987. For all such $m$ and $n$, what is the maximum value of $3m + 4n$?
18. Let \(a_{1}+a_{2}+\cdots+a_{m}+b_{1}+b_{2}+\cdots+b_{n}=1987\), where \(a_{i} (1 \leqslant i \leqslant m)\) are distinct positive even numbers, and \(b_{j} (1 \leqslant j \leqslant n)\) are distinct positive odd numbers. Clearly, \(n\) is odd, and \(a_{1}+a_{2}+\cdots+a_{m} \geqslant 2+4+\cdots+2 m = m(m+1)\), \(b_{1}+b_{2}+\cdots+b_{n} \geqslant 1+3+\cdots+(2 n-1) = n^{2}\). Therefore, \(m^{2}+m+n^{2} \leqslant 1987\), which implies \(\left(m+\frac{1}{2}\right)^{2}+n^{2} \leqslant 1987+\frac{1}{4}\). By the Cauchy-Schwarz inequality, we have \(3\left(m+\frac{1}{2}\right)+4 n \leqslant \sqrt{3^{2}+4^{2}} \sqrt{\left(m+\frac{1}{2}\right)^{2}+n^{2}} \leqslant 5 \sqrt{1987+\frac{1}{4}}\), thus \(3 m+4 n \leqslant 5 \sqrt{1987+\frac{1}{4}}-\frac{3}{2}\). Since \(3 m+4 n\) is an integer, we have \(3 m+4 n \leqslant 221\). It is easy to prove that the integer solutions of \(3 m+4 n=221\) are of the form \(m=71-4 k\), \(n=2+3 k\), where \(k \in \mathbf{Z}\). Since \(n\) is odd, \(k=2 t+1\) must be odd, where \(t \in \mathbf{Z}\), thus \(m=67-8 t\), \(n=5+6 t\), where \(t \in \mathbf{Z}\). Because \(m^{2}, n^{2} \leqslant 1987\), we have \(m, n < 44\). Substituting into the above equations, we get \(3 \leqslant t \leqslant 6\). When \(t=3,4,5,6\), the solutions are \((m, n)=(43,23),(35,29),(27,35),(19,41)\). It is easy to verify that \((m, n)=(27,35)\) is the solution we seek. In this case, the minimum value is 221.