codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1199B.md (1381B)


      1 Source: https://codeforces.com/problemset/problem/1199/B
      2 
      3 B. Water Lily
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 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.
     22 
     23  ![](https://espresso.codeforces.com/72bfc654b0e27860232cc343c81653b4597abd10.png) 
     24 
     25 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$?
     26 
     27 Input
     28 
     29 The only line contains two integers $H$ and $L$ ($1 \le H \lt L \le 10^{6}$).
     30 
     31 Output
     32 
     33 Print a single number — the depth of the lake at point $A$. The absolute or relative error should not exceed $10^{-6}$.
     34 
     35 Formally, let your answer be $A$, and the jury's answer be $B$. Your answer is accepted if and only if $\frac{|A - B|}{\max{(1, |B|)}} \le 10^{-6}$.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 1 2
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 1.5000000000000
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 3 5
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 2.6666666666667
     61 ```