Submit | All submissions | Best solutions | Back to list |
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
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/ |
hide comments
|
|||||||
2012-06-24 06:09:56 DaRksTar
double wrks....:) |
|||||||
2012-06-04 21:23:15 15972125841321
plz tell me where i m wrog my sub id is 7091407 i m getting correct ans for test cases.... |
|||||||
2012-02-20 18:55:51 Benjamin Pinaya
Does anybody has some more useful test cases? :D please! |
|||||||
2012-01-06 17:24:08 saket diwakar
finally got AC...those who r getting WA in C,take long double and pi= (3.141592653589793).. |
|||||||
2011-05-07 13:41:14 Gaurav
i tried both float and double but getting WA....cant understand the reason...please help |
|||||||
2010-07-01 18:42:19 Sai Kiran Reddy Jakka
got WA with float and double.....got accepted using long double..........LOL Last edit: 2010-07-01 18:42:58 |
|||||||
2010-06-10 17:48:17 Spooky
@Mayank Singh no, actually the problem is that you use Scanner... it's slow and the input is relatively large |
|||||||
2010-06-10 10:23:46 Mayank Singh
Java Math functions much slower than C++ 4.32.... TLE in Java and AC in C++ for the same program... |
|||||||
2010-05-14 16:34:38 Kuntal Ghosh
@Munesh Verma .....i got AC using float and WA using double ... :) |