no tags 

In the figure, angle BAC is a right angle. AD is the perpendicular to BC. P is the middle point of BC. ADMN is a square. You will be given two numbers representing the length of BD (L) and the area of ADMN (A). You have to find the length of AP.


The first line contains an integer T, (0 < T <= 100000) representing the number of test cases. The next T lines each contain two positive numbers L and A (0 < L, A <= 1.7E+308) as described above.


You have to print the length of AP with two digits after decimal point. The required format is given in the sample.

5 25
4 24
7 56

Case 1: 5.000000
Case 2: 5.000000
Case 3: 7.500000

Problem setter: Arifur Rahman Shojib

hide comments
rupakbis: 2023-02-19 16:18:47

picture is not clear. It is not visible
[Simes]: I've been unable to find the picture. If anybody can find a source for it, I will upload it.

Last edit: 2023-02-28 13:32:52
xuhd: 2015-09-12 09:36:42

Isn't AP = (L*L + A)/(2*L) ???!!
Why I get WA all the time!

by the way, WHY the text states that the answer should be printed
with two digit after decimal point, BUT the sample output with six??
I tried both format, %.2lf and %.6lf, all WA

ans -> %.2lf is enough for this problem. Your Solution can not pass all the Test Case. Check you equation and try again.

Last edit: 2015-10-04 20:52:15
Fata Nugraha: 2015-04-16 08:23:16

now the problem statement is clear.

Last edit: 2015-04-17 09:46:33

Added by:Najmuzzaman
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY