HAMSTER1 - Hamster flight


There is a competition of flying hamsters in Hamsterburg. Each competing hamster is thrown from a sling. The judges rate the flight according to its length and height. Let X meters be the distance of the flight, and Y meters – maximum height to which the hamster rose during the flight. The hamster will receive K1*X + K2*Y points for such a flight. The initial speed of the hamsters is V0 m/s. Free fall acceleration is g = 10 m/s2. There is no air friction. The size of the hamster and the sling are negligible. When the hamster is thrown from the sling its height is 0 meters. You should determine the angle at which the hamster must be thrown so that he receives maximum points.

Input

The first line of input contains number t – the amount of tests. Then t tests follow one per line. The description of each test consists of three integers separated by single spaces. The first integer is V0, the second – K1, the third – K2.

Constraints

1 <= t <= 10000
1 <= V0 <= 100
0 <= K1, K2 <= 1000
0 < K1 + K2

Output

For each test output the angle in radians at which the hamster must be thrown, and the amount of points it will receive. The numbers should be separated with spaces. Print the numbers with exactly three digits in the fractional part.

Example

Input:
3
10 10 0
10 0 10
10 10 10

Output:
0.785 100.000
1.571 50.000
0.908 128.078

hide comments
Sayak Haldar: 2015-10-20 12:02:02

try it to solve using binary search and face the true challenge...:)

Harshavardhan Jain: 2015-10-19 19:43:40

In Python, refrain from using the round() function. It gives a WA

Sandip Jana: 2015-06-23 13:54:39

:) GOOD QUESTION SIR... CONFIDENCE BOOSTED :D

vivek singh rana: 2015-02-11 12:06:47

g=10 gets accepted,g=9.8 gets wrong answer!!!

re(vamsi): It is clearly mentioned in the problem that g is 10

Last edit: 2015-02-11 13:02:43
Sumit Paroothi: 2015-01-19 23:09:42

my 100th AC ....easy one

Anirudh: 2014-08-06 06:06:33

Got AC with double and using a very precise value of pi.

The Mundane Programmer: 2013-08-12 16:53:10

Differentiation + Projectile ..... simple maths.... :D
Accepted In !st attempt.....

Ouditchya Sinha: 2013-06-21 14:16:36

Easy Problem, High School Maths!! :)

edit: must be nice to live in a country where high school maths are actually good

Last edit: 2013-12-15 19:29:09
Ashish Lavania: 2012-10-25 17:12:23

Spooky : my program works for all values still WA please check 7927933

Last edit: 2012-10-25 20:43:42
Ashwin Vedachalam: 2012-09-26 07:14:26

@ Spooky my program gives the same junk value in my system for all d inputs but it got AC in the judge.


Added by:Spooky
Date:2009-04-10
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Advancement Spring 2009, http://sevolymp.uuuq.com/