atcoder#ARC158B. [ARC158B] Sum-Product Ratio
[ARC158B] Sum-Product Ratio
Score : points
Problem Statement
You are given non-zero integers . Find the minimum and maximum values of for integers , , such that .
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the minimum value of in the first line and the maximum value in the second line.
Your output will be considered correct when the absolute or relative error is at most .
4
-2 -4 4 5
-0.175000000000000
-0.025000000000000
can take the following four values.
- : $\dfrac{(-2) + (-4) + 4}{(-2)\cdot (-4)\cdot 4} = -\dfrac{1}{16}$.
- : $\dfrac{(-2) + (-4) + 5}{(-2)\cdot (-4)\cdot 5} = -\dfrac{1}{40}$.
- : $\dfrac{(-2) + 4 + 5}{(-2)\cdot 4\cdot 5} = -\dfrac{7}{40}$.
- : $\dfrac{(-4) + 4 + 5}{(-4)\cdot 4\cdot 5} = -\dfrac{1}{16}$.
Among them, the minimum is , and the maximum is .
4
1 1 1 1
3.000000000000000
3.000000000000000
5
1 2 3 4 5
0.200000000000000
1.000000000000000