BABA1 - ARE YOU GOOD IN MATHS?
BABA taught properties of right angled triangle and asked a questions: "Can you find a right angled triangle whose length of hypotenuse is H and its area is A?"
INDIAN students can answer quickly.
Input
The first line of the input contains a single integer T (where 1 ≤ T ≤ 10^5) denoting the number of test-cases. T test cases follow.
For each test case, there will be a single line containing two space separated integer H and A (where 1 ≤ H ≤ 10^6 and 1 ≤ A ≤ 10^12).
Output
Output the answer for each test-case in a single line. If it is not possible to find such a triangle, output -1.
Otherwise print 3 real numbers corresponding to the lengths of the sides of the triangle sorted in non-decreasing order.
NOTE: give your answer with 6 decimal places.
Example
Input: 4 24252 56578987908 1 1 2 2 10 10 Output: -1 -1 -1 2.043096 9.789063 10.000000
hide comments
jmr99:
2018-06-20 09:21:07
simple math ..but take,sf,pf & print double i got 3 WA !! then AC |
|
shubham9261:
2017-10-01 23:49:20
yup,no binary search required
|
|
matcha1998:
2017-09-13 10:43:29
No Binary Search required!!
|
|
mahilewets:
2017-08-26 11:58:16
You can solve it without binary search
|
|
varun6325:
2017-08-23 21:11:04
Use printf instead of cout to print the double output |
|
sagnik_66:
2017-05-28 08:59:29
Binary Search Tag is misleading! Not required at all |
|
quantic:
2017-02-15 10:17:40
kindergarten mathematics... Last edit: 2017-02-15 17:30:32 |
|
adityaghosh96:
2017-02-15 09:34:55
No binary search required. Last edit: 2017-02-15 19:01:37 |
Added by: | junior_g |
Date: | 2017-02-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ADA95 ASM32-GCC ASM32 ASM64 BASH BC BF COBOL COFFEE D-CLANG D D-DMD DART ELIXIR ERL FANTOM FORTH FORTRAN CHICKEN |