CF1199B.Water Lily
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
While sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly H centimeters above the water surface. Inessa grabbed the flower and sailed the distance of L centimeters. Exactly at this point the flower touched the water surface.

Suppose that the lily grows at some point A on the lake bottom, and its stem is always a straight segment with one endpoint at point A. Also suppose that initially the flower was exactly above the point A, i.e. its stem was vertical. Can you determine the depth of the lake at point A?
伊内萨乘船航行时,注意到湖面上方有一朵美丽的睡莲花。她靠近后发现,这朵花恰好高出水面 H 厘米。伊内萨抓住花朵,又向前航行了 L 厘米,此时花朵恰好触及水面。

假设这朵睡莲生长在湖底某点 A 处,且其花茎始终是一条线段,一端固定于点 A。再假设初始时刻花朵恰好位于点 A 的正上方,即其花茎呈竖直状态。你能求出点 A 处湖水的深度吗?
输入格式
The only line contains two integers H and L (1≤H<L≤106).
唯一的一行包含两个整数 H 和 L(1≤H<L≤106)。
输出格式
Print a single number — the depth of the lake at point A. The absolute or relative error should not exceed 10−6.
Formally, let your answer be A, and the jury's answer be B. Your answer is accepted if and only if max(1,∣B∣)∣A−B∣≤10−6.
输出一个整数——点 A 处湖的深度。绝对误差或相对误差均不得超过 10−6。
形式化地,设你的答案为 A,评测组的答案为 B。当且仅当 max(1,∣B∣)∣A−B∣≤10−6 时,你的答案被视为正确。
输入输出样例
输入#1
1 2
输出#1
1.5000000000000
输入#2
3 5
输出#2
2.6666666666667
输入解题思路,AI测评打分。不知道怎么写?