Problem D
Airport
Input: Standard Input
Output: Standard Output
|
It is no coincidence
that in no known language |
Douglas
Adams
There is a small town with n houses. The town needs an airport. An airport is basically a very long, very straight road. Think of it as an infinite line. We need to build the airport such that the average distance from each house to the airport is as small as possible. However, no one wants to walk across the runway, so all of the houses must be on the same side of the airport. (Some houses may be a distance of zero away from the runway, but that's ok; we'll give them some free ear plugs.)
Where should we build the airport, and what will be the average distance?
For each test case, output one line containing "Case #x:" followed by the average distance from the airport to the houses, with 3 digits after the decimal point. No answer will be within 10-5 of a round-off error case.
440 00 11 01 1215035 3957234582 3953530 00 11 050 00 22 02 21 1 |
Case #1: 0.500 Case #2: 0.000 Case #3: 0.236 Case #4: 1.000 |
Problemsetters: Igor Naverniouk and Derek
Kisman