Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Stay Home! Warm Your Love for Geometry!!

By the_belal · Limits 1s, 512 MB

You are given a right triangle ABC where angle ABC is the right angle and BD is perpendicular to AD . The values of AB and BC are given in the input. All you need to do is finding out the value of $ {x}^{2} + {yz} - {z}^{2} $ . Can you do the easiest job here? Yes, you can. I have firm faith on you.


First line will contain an integer T, the number of test cases (1<=T<=500) and the following T lines will contain exactly two integers AB, BC ( 1<=AB,BC<=1000000000 ).


You have to print a number for every test case in a separate line which denotes the value of $ {x}^{2} + {yz} - {z}^{2} $. Your answer will be considered as correct if its absolute or relative error does not exceed 10-6.

Formally, let your answer be a, and jury's answer be b, your answer is accepted if and only if $ \frac{|a-b|}{max(1, |b|)} <= {10}^{-6} $ .


5 5
9 12




    86% Solution Ratio

    Tawsifiit48Earliest, 1M ago

    rajin_siamFastest, 0.0s

    Tawsifiit48Lightest, 131 kB

    anonyo.akandShortest, 105B


    Login to submit