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

hide comments
Ouditchya Sinha: 2013-01-27 09:36:30

@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
Mahavir Chopra: 2013-01-24 21:41:56

mid=(a+b)/2.000000;
if(f(mid)>0)
b=mid;
else
a=mid;
is this correct

Tushar Makkar (Retired): 2013-01-18 11:18:32

I am getting the same problem as Ankit Paharia . Can anybody tell me what is wrong with it ? Sub id = 8525138

innovolt: 2013-01-18 10:49:17

use bisection method got AC in 0.04 sec
take x1=0,x2=1000 x3=(x1+x2)/2 run loop 100 times..............

knapsack-n: 2012-08-13 19:34:04

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!!!!

aman garg: 2012-07-24 09:52:42

sub ID : 7365932

aman garg: 2012-07-24 09:52:01

Getting WA continuously...
used newton raphson until (x1-x0)*x1 >= epsilon

Ankit Paharia: 2012-07-09 12:23:14

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

StupidGuy: 2012-07-09 09:19:28

Got AC! :) was doing stupid mistake.

Last edit: 2012-07-09 09:24:30

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