問題一覧 > 通常問題

No.735 Tangent Line

レベル : / AI推定難易度 : 147 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-3}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 341
作問者 : butsurizuki / テスター : ciel
お気に入りにしたユーザー ProblemId : 2285 / 自分の提出
問題文最終更新日: 2026-10-14 11:37:09
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 200 (順位表) の他の問題:

Note

2026/10/14 The allowed error has been changed to 0.001. This is because 99_system_test1.txt is quite a severe case.
Reading 524288.000001 into a double already exceeds a precision of $10^{-6}$. The code that solves this most accurately: #1193071

Problem Statement

There are a circle $O$ of radius $r$ and a point $A$ outside the circle at distance $d$ from $O$.
Draw a tangent from point $A$ to circle $O$, and let $L$ be the point of tangency. Find the length of segment $AL$.
(Two tangents can be drawn from point $A$ to circle $O$, but it can be shown that both have the same length.)

Input

$r$ $d$

・Constraints
$0 < r < d < 10^6$
$r,d$ are given to the 6th decimal place

Output

Output the answer on one line, followed by a newline.
An absolute or relative error of at most $10^{-3}$ is allowed.

Sample

Sample 1
Input
3.000000 5.000000
Output
4.000000000000

Sample 2
Input
123.456789 123.456790
Output
0.015713483953

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。