No.306 Saitama 2008
タグ : / 解いたユーザー数 352
作問者 :
koyumeishi
Problem Statement
In the first quadrant of the xy-plane, there are a point $A$ $(x_a, y_a)$ and a point $B$ $(x_b, y_b)$. Here, the first quadrant means the region where x>0 and y>0.
Place a point $P$ $(0, y_p)$ on the y-axis so that $|AP|+|PB|$ is minimized. $|AP|$ and $|PB|$ denote the Euclidean distances between the respective points.
Input
$x_a$ $y_a$ $x_b$ $y_b$
The first line gives the coordinates of point $A$, and the second line gives the coordinates of point $B$.
The input is given as integers and satisfies the following condition.
$0 < x_a, x_b, y_a, y_b < 1000$
Output
$y_p$
Output the y-coordinate of point $P$.
Your answer is considered correct if its absolute error or relative error from the judge's solution is at most $10^{-6}$.
Sample
Sample 1
Input
1 2 3 4
Output
2.5
This is the example shown in the image in the problem statement.
Sample 2
Input
100 100 100 200
Output
150
Sample 3
Input
114 514 114 514
Output
514
It is not guaranteed that $A \neq B$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。