For real parameters c and d, the equation
x = 1/2 + c (x^3 - sin(d x)) / (4 + x^2)
has a unique solution x* in [0, 1].
You are given q queries. For each, compute x*.
The first line contains the integer q. Each of the next q lines contains c and d, each with at most 6 digits after the decimal point.
q lines, line i containing x* for query i, with relative error at most 1e-9.
1 <= q <= 1000
-1 <= c <= 1
0 <= d <= 2
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
Numeric answers are accepted if they are within a relative tolerance of 1e-09 of the expected value.
3 0.0 0.0 1.0 1.0 -0.5 2.0
0.5 0.4200978288395543 0.5830665259477369
1 0.8 1.5
0.40330625119482577