$(1)$
\[A_1V_1=A_2V_2=Q\]
$(2)$
\[\frac{p_1}{\rho_w}+\frac{v_1^2}{2}=\frac{p_2}{s_w}+\frac{V_2^2}{2}\]
$(3)$
\[p_1+\rho_wgh=p_2=\rho_mgh\]
$(4)$
\[
(2)より\hspace{10mm}p_1-p_2=\frac{\rho_w}{2}(V_2^2-V_1^2) \hspace{10mm}\cdots(2)'\\
(3)より\hspace{10mm}p_1-p_2=(\rho_2^2-\rho_1^2)gh \hspace{10mm}\cdots(3)'
\]
\[(2)',(3)'より\hspace {10mm}(\rho_m-\rho_w)gh=\frac{\rho_w}{2}(V_2^2-V_1^2)\]
\[(1)より\hspace {10mm}V_1=V_2\frac{A_2}{A_1}だから\\
(\rho_m-\rho_w)gh=\frac{\rho_w}{2}(V_2^2-\frac{A_2^2}{A_1^2}V_2^2)\]
\[V_2^2=\frac{1}{1-(\frac{A_2}{A_1})^2}2gh\frac{\rho_g-\rho_w}{\rho_w}\\
V_2=\frac{1}{\sqrt{1-(\frac{A_2}{A_1})^2}}\sqrt{2gh(\frac{\rho_m}{\rho_w}-1)}\]
\begin{align}
\therefore Q&=A_2V_2=題意
\end{align}