By XVII Maratona de Programação IME-USP, 2013 Brazil
A company wants bring down a building to build a garden in Ecaterimburgo's main avenues, but wants to do a study before this: discover the time of sunshine that garden will receive per day, considering that she will bring down the chosen building and build the garden in that place. This is important, because sun bath is a very popular activity between people from this city during the summer. The garden receives sunlight if at least a piece of this garden have been receiving sunlight.
To turn easy this things, the builder chose a day of the year to do measurements. In that day the sun rises at 5:30 and sets at 21:30 (in the russian summer the days are long). Consider that the sun has constant angular speed in sky and it rises in the east and sets in the west.
All buildings are aligned in direction east-west, they have the same width and spacing between them is constant, the garden will have the same buildings' width.
The input is composed of different instances and ends with end of file(EOF).
Every instance consists of 2 lines. The first line contains 3 integers N (2 ≤ N ≤ 100), L, D (1 ≤ L, D ≤ 100), the number of buildings, the width of each one of them, and spacing between them, respectively. The second line contains N integers hi (0 ≤ hi ≤ 50), the height of the buildings. A height with value 0 mean that the garden will be built at that position and will appear exactly one time. All measurements are meters.
For each test case, print a line containing the time, in minutes, of sunlight that garden will receive on the chosen day, approaching for 2 decimal places.
Sample Input | Sample Output |
3 2 1 |
254.20 |