#P12303. [ICPC 2023 WF] Waterworld
[ICPC 2023 WF] Waterworld
题目描述
Thousands of planets outside the Solar System have been discovered in recent years. An important factor for potential life support is the availability of liquid water. Detecting water on faraway planets is not easy. For rotating planets, a brand-new technology using relativistic quantum-polarized spectroscopy can help. It works as follows (this is a simplified description as only three people on this planet understand how it really works).
Assume the telescope shows the planet such that its rotating axis is vertical and its equator is horizontal. Only the vertical line at the center of the image (the line that covers the rotating axis) is analyzed, because it provides the highest resolution of the planet's surface.
The analysis proceeds in steps of degrees. In one step, data is aggregated while the planet rotates by degrees, so each step gives information about a slice of degrees of the planet's surface. The image is split into segments of equal height, which are analyzed separately. So the slice of degrees is partitioned into areas . For each area , image analysis produces a number that gives the percentage of covered by water. The areas for one step are highlighted in the diagram on the right.

You may assume the planet's surface is a sphere. This means each area is a spherical quadrilateral: it has four vertices, two sides parallel to the equator (that is, in planes parallel to the equator's plane) and two sides on great circles through the planet's poles, where the great circles are degrees apart. At either pole, two of the four vertices collapse into the pole, so and are spherical triangles with only one side parallel to the equator. Due to the curvature of the surface, sides that are parallel to the equator are longer if they are closer to the equator, while sides on great circles are longer if they are closer to the poles.
The above process is repeated for the next degrees of rotation, and so on, a total number of times, until the whole surface of the planet has been covered (that is, degrees). Your task is to compute the percentage of the planet's surface covered by water from the given data.
输入格式
The first line of input contains the two integers and (). Each of the following lines contains integers ( for and ). Each column of this matrix describes the measurements for a single step, that is, a rotation by degrees. The number is the percentage of area that is covered by water in the step.
输出格式
Output the percentage of the planet's surface covered by water. Your answer should have an absolute error of at most .
3 7
63 61 55 54 77 87 89
73 60 38 5 16 56 91
75 43 11 3 16 20 95
51.809523810
4 3
10 10 10
10 10 10
10 10 10
10 10 10
10.000000000