题目描述
Problem Description
dwango has a new office, and today is the first day of work in this office.
Niwango, an employee, arrived at the nearest station to the office but realized he didn't know where the office was.
The new dwango office is located on a single road, and the nearest station to the office is at coordinate 0. There are N intersections on this road, and Niwango knows the office must be at one of these intersections. The office could be at a negative coordinate. Note that there is no intersection at coordinate 0.
Niwango decided to walk around the road to find the office. He can only determine if the office is at an intersection when he reaches that intersection.
Niwango's boss knows the time Niwango arrived at the station. Since all dwango employees walk at a speed of one unit of distance per unit of time, if the distance from the station to the office is x, and Niwango arrived at the station at time 0, he will be scolded if he arrives at the office after time x. It's fine if he arrives before time x.
Niwango thought about always running at a constant speed to ensure that he arrives at the office by time x, no matter which intersection the office is at. He wants to run as slowly as possible, so he decided to choose an appropriate path to minimize his running speed.
Find the minimum possible value for Niwango's running speed.
Input Format
The input is given from the standard input in the following format:
$ N $ $ x_1 $ . . . $ x_N $
- The first line contains an integer $N(1\ ≦\ N\ ≦\ 1000)$.
- The next $ N $ lines contain integers $x_i(-10^9\ ≦\ x_i\ ≦\ 10^9,\ x_i\ ≠\ 0)$, representing the position of the i-th intersection. For any $i(1\ ≦\ i\ ≦\ N-1)$, $x_i\$ is satisfied.
Output Format
Output the minimum running speed of Niwango in one line. You can output as many decimal places as you like, but the absolute or relative error between your output and the true value should be within $ 10^{-9} $.
Do not forget to add a newline at the end of the output.
Sample Input and Output
Sample Input #1
4
-3
-1
1
2
Sample Output #1
3.00000000000000
Sample Input #2
5
-5
-2
2
4
7
Sample Output #2
4.14285714285714
Sample Input #3
9
-18
-13
-11
-6
-2
1
6
16
17
Sample Output #3
4.37500000000000
Notes/Hints
Partial Points
This problem has partial points.
- If you solve the dataset where $N\ ≦\ 200$, you will be awarded 70 points as partial credit.
- If you solve all datasets, you will be awarded an additional 50 points, totaling 120 points.
Sample Explanation 1
An example of Niwango's movement is as follows:
- Move to the 2nd intersection at speed 3 and check if it's the office.
- If not, move to the 3rd intersection at speed 3 and check if it's the office.
- If not, move to the 4th intersection at speed 3 and check if it's the office.
- If not, move to the 1st intersection at speed 3 and check if it's the office.
In this scenario, he can move to the 1st, 2nd, 3rd, and 4th intersections in 3, 1/3, 1, and 4/3 units of time respectively, satisfying the conditions in the problem statement.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分