[USACO 2014 Mar G]Sabotage
题号:NC24591
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

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

The milking equipment consists of a row of N (3 <= N <= 100,000)
milking machines, where the ith machine produces M_i units of milk (1
<= M_i <= 10,000). Farmer Paul plans to disconnect a contiguous block
of these machines -- from the ith machine up to the jth machine (2 <=
i <= j <= N-1); 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.

输入描述:

* Line 1: The integer N.

* Lines 2..1+N: Line i+1 contains M_i

输出描述:

* 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.
示例1

输入

复制
5
5
1
7
8
2

输出

复制
2.667