There is an array of
In each operation, you may choose an arbitrary number of
Compute the maximum possible
Input Specification
The first line of the input consists of three positive integers
The next line consists of
Output Specification
Output a line with a real number denoting the maximum
The answer can only contain a non-negative integer part, the decimal point, and the decimal part. The non-negative integer part is required, and it is unnecessary to add signs before the output. If there is a decimal part, the integral part and the decimal part are separated by a decimal point. If there is no decimal part, there shall be no decimal points.
In your output, there can be at most
Your output is considered to be correct if and only if the absolute difference between your output and the reference answer is less than
If the absolute difference between your output and the reference answer is at least
Sample Input 1
3 1 3
1 4 3
Sample Output 1
2.666667
Explanation for Sample 1
There are five possibilities since we can use at most one operation (not counting the trivial operation when you just choose one number).
- Performing no operations:
. - Choosing
: now . - Choosing
: now . - Choosing
: now . - Choosing
: now .
Sample Input 2
3 2 3
1 4 3
Sample Output 2
3.000000
Explanation for Sample 2
The optimal solution is to apply two operations: first, choose
Attachment Package
The samples are available here.
Sample 3
See ex_drink3.in
and ex_drink3.ans
.
Constraints
Test case | |||
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 | |||
16 | |||
17 | |||
18 | |||
19 | |||
20 |
For all test cases, it is guaranteed that
Hints
To guarantee precision, we need to keep more than
A library for high-precision floating number operations is provided here.
Using the library is optional.
The Decimal
library supports high-precision floating point addition, subtraction, multiplication, division, comparisons, and conversions to and from double
, integers, and strings. Note: Here, one operand for multiplication and division must be an integer. You cannot multiply a double
or a Decimal
with another Decimal
.
The library defines a constant drink_sample.cpp
, const int PREC = 2100;
defines the constant #define PREC 2100
in the 9-th line of drink_sample.c
defines the constant 2100
in the 8-th and the 14-th lines of drink_sample.pas
is the constant
The time complexity of any arithmetic operation provided by the library is bounded above by
The space complexity of any instance of the Decimal
class is bounded above by
When calling a function provided by the Decimal
class, the following conditions must be satisfied:
- In each intermediate step, a
Decimal
number has an absolute value of at most . int/longint
parameters have absolute values of at most .long long/int64
parameters have absolute values of at most .- A
double
parameter must be a valid real number and has an absolute value of at most . - An argument of type
string
must represent a valid real number. In other words, the string should begin with the sign part (a negative number has a minus sign, and a non-negative number has no signs), then a string consisting of digits representing the integer part, a decimal point, and a string consisting of digits representing the decimal part. The decimal part and the decimal point can be omitted simultaneously. The string should not represent a real number with absolute value greater than . - You cannot divide by zero.
- When converting a
Decimal
to a string, the number of digits after the decimal point must be greater than zero. If you are using C, please make sure you've allocated enough space to store the string returned byto_string_d(Decimal, char*, int)
.
The programs drink_sample.cpp/c/pas
are empty programs except the library. You may work directly on the samples, but this is optional.
The programs decimal_test.cpp/c/pas
are example programs for the Decimal
library. You can use the program to learn more about the interfaces and the implementation of the library, as well as how to use each function of the library.
Comments