問題一覧 > 通常問題

No.306 Saitama 2008

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 256 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-6}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 352
作問者 : koyumeishi
お気に入りにしたユーザー ProblemId : 853 / 自分の提出
問題文最終更新日: 2026-06-25 16:21:15
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 128 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。