Satellite Antenna
Time Limit: 1 Second Memory Limit: 32768 KB
In this summer vacation, jfjiang received a gift -- a satellite TV signal receiver. In the menu book it says:
1. This receiver can be connected to several adapted satellite antennae, which
can receive TV signals from synchronous satellites.
2. The direction of the antenna can be converted into longitude. The situation
may be simplified to consider that the antenna is pointing to a cetain longitude
above equator.
3. Each antenna covers a longitude range of 25 degrees. That is, if the difference
between the longitudes of two satellites is no greater than 25 degrees, the
signals from both satellites can be received by one antenna.
4. The quality of the signals received depends on the angle of the antenna.
For some satellite x, the quality of its signal can be computed by the following
formula:
Qx = 100 - | angle - ax |
where angle is the longitude the antenna is pointing to, and ax is the longitude
the satellite stays at.
After making all these clear, jfjiang found a table containing all the satellites
which can be received from his home and a list of programs. Reading up the table,
jfjiang found his favorite programs on every satellite. It seems that one way
to get all his favorite programs on TV is to buy several more antennae so that
all the satellites can be covered. Well, of course he will encounter serious
financial problems if he really does so. Since he has only limited money and
limited places to set antennae, he intends to minimize the amount of antennae
he has to buy, yet at the mean time, to obtain maximum sum of signal qualities.
Having finally finished reading the list of all the programs, jfjiang is too
dizzy to write a program himself to do the computation. Therefore he comes to
you, his friend in our ACM/ICPC teams, to do the computation for him.
Input
There are several test cases. Each case consists of two lines:
The first line contains an integer n (1 <= n <= 100) which is the total
number of satellites.
The second line contains n floating numbers which are the longitude positions
of the satellites.
Output
For each test case, print in a single line two numbers: an integer m, which
is the minimum number of antennae required, and a floating number q, which is
the maximum sum of signal qualities with m antennae.
There must be one space between m and q, and q must be accurate up to 2 decimal
places.
Sample Input
5 10.41 14.67 13.34 15.00 11.69
Sample Output
1 492.43Submit
Source: ZOJ Monthly, February 2003