[BOJ 10560] Function

View as PDF

Submit solution

Points: 1
Time limit: 5.0s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

[\text{Let}\(t = n/m;\)\(None\)z\left[ t \right] =\begin{cases} (a+(b+rt^{ 2 })z\left[ -1-2t \right] )/r & \text{ if }\( t\le 0 \\ (c+(d+rt^{ 2 })z\left[ 1-2t \right] )/r & \text{if}\)t > 0 \end{cases}]</p>

Given integer (a), (b), (c), (d), (n), (m), and (r), evaluate (z\left[ t \right]) (as a floating point number).

[1 \le n \le m \le 100 \ 1 \le b \le r \ 1 \le d \le r \ 1 \le r \le 1000 \ 1 \le a \le 1000 \ 1 \le c \le 1000]

There will be a solution. Your result must be accurate to within ±10−6 absolute error, or ±10−6 relative error.

입력 형식

On the first line will be the number of functions to solve, between 1 and 100 inclusive. Following that will be one line per function, giving the integer parameters separated by spaces in the order (n), (m), (a), (b), (c), (d), (r).

출력 형식

The value of the (z \left[n/m \right]) should be printed in floating point format, one line per parameter set.

예제 입력

3
1 1 1 1 1 1 1
2 3 1 2 3 4 10
2 3 5 6 7 8 9

예제 출력

-1
0.4225806452
4.111111111

Comments

There are no comments at the moment.