## Sabotage

View as PDF

Points: 20
Time limit: 1.0s
Memory limit: 64M

Problem type

Farmer John's arch-nemesis, Farmer Paul, has decided to sabotage FarmerJohn's milking equipment!

The milking equipment consists of a row of () milking machines, where the th machine produces units of milk (). Farmer Paul plans to disconnect a contiguous block of these machines -- from the th machine up to the th machine (); note that Farmer Paul does not want to disconnect either the first or the last machine, since this will make his plot too easy to discover. Farmer Paul's goal is to minimize the average milk production of the remaining machines. Farmer Paul plans to remove at least 1 cow, even if it would be better for him to avoid sabotage entirely.

Fortunately, Farmer John has learned of Farmer Paul's evil plot, and he is wondering how bad his milk production will suffer if the plot succeeds. Please help Farmer John figure out the minimum average milk production of the remaining machines if Farmer Paul does succeed.

INPUT FORMAT:

Line : The integer .

Lines ..: Line contains .

SAMPLE INPUT:

5
5
1
7
8
2

OUTPUT FORMAT:

• Line 1: The lowest possible average Farmer Paul can achieve, rounded to 3 digits after the decimal point, and printed with 3 digits after the decimal point.

SAMPLE OUTPUT:

2.667

OUTPUT DETAILS:

The optimal solution is to remove the 7 and 8, leaving 5, 1, and 2, whose average is 8/3.