Problem 961: (2005 AIME I, 11)
A semicircle with diameter $d$ is contained in a square whose sides have length 8. Given the maximum value of $d$ is $m - \sqrt{n},$ find $m+n.$
- By symmetry the largest semicircle has its diameter perpendicular to a diagonal of the square, with endpoints on two adjacent sides and the arc tangent to the other two sides.
- With the corner at the origin and radius $r$, the center is $(8-r,8-r)$ and the endpoint $\bigl(8-r-\frac r{\sqrt2},\,8-r+\frac r{\sqrt2}\bigr)$ lies on $x=0$, so $r\left(1+\frac1{\sqrt2}\right)=8$.
- $r=16-8\sqrt2$, so $d=32-16\sqrt2=32-\sqrt{512}$ and $m+n=544$. The answer is $\boxed{544}$.
A semicircle with diameter $d$ is contained in a square whose sides have length 6. Given the maximum value of $d$ is $m - \sqrt{n},$ find $m+n.$