Inspired by Bermuda Triangle

Nahid001 RUET CodeSmash 2020
Limits 1s, 512 MB

Do you know about Bermuda Triangle?

The Bermuda Triangle is a mythical section of the Atlantic Ocean roughly bounded by Miami, Bermuda, and Puerto Rico where dozens of ships and airplanes have disappeared. Unexplained circumstances surround some of these accidents, including when the pilots of a squadron of U.S. Navy bombers became disoriented while flying over the area; the planes were never found. Other boats and planes have seemingly vanished from the area in good weather without even radioing distress messages. But although myriad fanciful theories have been proposed regarding the Bermuda Triangle, none of them prove that mysterious disappearances occur more frequently there than in other well-traveled sections of the ocean. People navigate the area every day without incident.

Inspired by the Bermuda Triangle , we want to make a CSE Triangle beside the CSE Building of RUET to disappear our frustration and depression.

A triangular fence "CSE Triangle" has to be designed with a wall of length XX and a fence of length SS which has to be broken into precisely two parts . You have to maintain an angle between the baseline of the wall and any one side of the fence .

Now, find the length of the pieces of fence that you have to break.


The first line of input contains an integer TT denoting the number of test cases.

Each test case contains three integers  XX , SS and θθ denoting the length of the wall , the length of the fence and the angle between the baseline of the wall and a side of the fence in degree.

1T1051 \leq T \leq 10^5

1X,S1091 \leq X,S \leq 10^9

0θ1800\leq θ\leq 180


The output has to be expressed as aa bb , where aa and bb are the lengths of the pieces of fence and aba\geq b.

If it’s not possible to make a perfect CSE Triangle print 1-1.

Your answer is considered correct if its absolute or relative error does not exceed 10610^{-6}.

Formally, let your answer be xx and the jury's answer be yy. Your answer is accepted if and only if xymax(1,y)106\frac{|x - y|}{max(1, |y|)} \leq 10^{-6} .


12 18 90
80 114 97
13 5
87.349397 26.650602


Login to submit.


86% Solution Ratio
montashir_fahiEarliest, 1M ago
OnikJahanSagorFastest, 0.0s
user.325730Lightest, 2.0 MB
steinumShortest, 603B
Toph uses cookies. By continuing you agree to our Cookie Policy.