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
2013-01-27 09:36:30 Ouditchya Sinha
@worldcreator thank you for tip. AC at last :)

EDIT: I took x1 = 0 , x2 = 2500 , iterated 50 times using newton-ralphson method with fast i/o to get AC in 0.02s, wonder how 0.00s is possible?

Last edit: 2013-04-26 08:57:07
2013-01-24 21:41:56 Mahavir Chopra
mid=(a+b)/2.000000;
if(f(mid)>0)
b=mid;
else
a=mid;
is this correct
2013-01-18 11:18:32 Tushar Makkar (Retired)
I am getting the same problem as Ankit Paharia . Can anybody tell me what is wrong with it ? Sub id = 8525138
2013-01-18 10:49:17 innovolt
use bisection method got AC in 0.04 sec
take x1=0,x2=1000 x3=(x1+x2)/2 run loop 100 times..............
2012-08-13 19:34:04 knapsack-n
easy problem use newton raphson...take care of no of iteration....


Last edit: 2012-08-13 19:34:23
2012-08-01 14:10:17 :)
oh man what a question!!!!
2012-07-24 09:52:42 aman garg
sub ID : 7365932
2012-07-24 09:52:01 aman garg
Getting WA continuously...
used newton raphson until (x1-x0)*x1 >= epsilon
2012-07-09 12:23:14 Ankit Paharia
I am using newton raphson with an initial guess and 6 iterations..... getting WA... my code works fine for the given test case... plzz give some more test cases..... sub ID 7286879
2012-07-09 09:19:28 StupidGuy
Got AC! :) was doing stupid mistake.

Last edit: 2012-07-09 09:24:30
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.