#P5602. Maximizing Comfort with a Subset of Dishes

    ID: 18832 Type: Default 1000ms 256MiB

Maximizing Comfort with a Subset of Dishes

Maximizing Comfort with a Subset of Dishes

Small E has n dishes to choose from, each of which can be eaten at most once. The i-th dish has a tastiness value \(a_i\). Eating a dish with tastiness value \(a_i\) increases Small E's satisfaction by \(a_i\), and each dish eaten increases his fullness by 1.

The final comfort is defined as:

\(\text{comfort} = \frac{(\text{satisfaction})^2}{\text{fullness}}\)

Your task is to choose a non-empty subset of dishes to maximize the comfort.

inputFormat

The first line contains an integer n \( (1 \le n \le 10^5)\), representing the number of dishes.

The second line contains n space-separated integers \(a_1, a_2, \ldots, a_n\) \( (1 \le a_i \le 10^9)\), representing the tastiness values of the dishes.

outputFormat

Print the maximum comfort value that Small E can achieve. The answer should be a floating point number rounded to six decimal places.

sample

3
3 1 2
12.500000