TRIGALGE - Easy Calculation

Find x such that Ax+Bsin(x)=C.

Input

The first line denotes T (number of test cases). 3T integers follow denoting A,B and C for every test case. (A >= B > 0). All Integers are less than 100000.

Output

T real numbers rounded to 6 digits one in each line.

Example

Input:
1
1 1 20

Output:
19.441787

Added by:Saransh Bansal
Date:2012-02-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2012-07-08 15:48:51 StupidGuy
I am getting WA...Code works fine for given test case...Do i have to set precision?
Please someone post more test cases..
2012-06-28 16:50:57 unXled
simple newton raphson with a optimal initial guess...got AC in 0.02 :)
2012-05-14 10:19:46 suraj
@D: thanks for the reply. I was taking x as degree (not in radian) while calculating sin(x). now i got the question.
2012-05-14 06:24:36 :D
I don't know what calculator your using, but that's a wrong value. Just run it on google.
2012-05-13 21:00:07 suraj
with the 19.441787 + sin(19.441787)=19.774635955 not 20
2012-05-13 12:14:35 :D
x is a scalar, so it's a radians value for sin.

19.441787 + sin(19.441787) = 20.0000005
2012-05-13 12:02:13 suraj
with the 19.441787 + sin(19.441787)=19.774635955 not 20

Last edit: 2012-05-13 20:50:22
2012-05-13 12:01:48 suraj
can any one ex[lain me the output,because
19.441787+sin (19.441787×3.14159÷180)=19.447709267, not equal to 20
2012-05-07 13:11:14 Paras Sharma
directly newton raphson in 6 iteration is working :D AC in 0.01 sec.
just you need to take good initial guess.

Last edit: 2012-05-07 13:12:04
2012-04-08 16:00:56 (Tjandra Satria Gunawan)(曾毅昆)
regula falsi, AC 0.01s ;)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.