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 HH centimeters above the water surface. Inessa grabbed the flower and sailed the distance of LL centimeters. Exactly at this point the flower touched the water surface.

Suppose that the lily grows at some point AA on the lake bottom, and its stem is always a straight segment with one endpoint at point AA. Also suppose that initially the flower was exactly above the point AA, i.e. its stem was vertical. Can you determine the depth of the lake at point AA?

伊内萨乘船航行时,注意到湖面上方有一朵美丽的睡莲花。她靠近后发现,这朵花恰好高出水面 HH 厘米。伊内萨抓住花朵,又向前航行了 LL 厘米,此时花朵恰好触及水面。

假设这朵睡莲生长在湖底某点 AA 处,且其花茎始终是一条线段,一端固定于点 AA。再假设初始时刻花朵恰好位于点 AA 的正上方,即其花茎呈竖直状态。你能求出点 AA 处湖水的深度吗?

输入格式

The only line contains two integers HH and LL (1≤H<L≤1061 \le H \lt L \le 10^{6}).

唯一的一行包含两个整数 HH 和 LL(1≤H<L≤1061 \le H \lt L \le 10^{6})。

输出格式

Print a single number — the depth of the lake at point AA. The absolute or relative error should not exceed 10−610^{-6}.

Formally, let your answer be AA, and the jury's answer be BB. Your answer is accepted if and only if ∣A−B∣max⁡(1,∣B∣)≤10−6\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}.

输出一个整数——点 AA 处湖的深度。绝对误差或相对误差均不得超过 10−610^{-6}。

形式化地,设你的答案为 AA,评测组的答案为 BB。当且仅当 ∣A−B∣max⁡(1,∣B∣)≤10−6\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6} 时,你的答案被视为正确。

输入输出样例

  • 输入#1

    1 2

    输出#1

    1.5000000000000
  • 输入#2

    3 5

    输出#2

    2.6666666666667

输入解题思路,AI测评打分。不知道怎么写?

首页