|
||||||||||
BatteryTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 299 Accepted Submission(s): 89 Problem Description Recently hzz invented a new kind of solar battery. The battery is so amazing that the electric power generated by it can satisfy the entire village. People in the villager are all very happy since they can get free and green energy from now on. But the manager of a power company is sorrow about this. So he plans to take some action to obstruct the battery. The battery can be regarded as a segment of L meters. And the manager plans to build n pillars on the battery. Like the picture above, the distance between pillar i and the battery's left end is Xi, and its height is Hi. The thickness of all pillars can be ignored. When the sunlight is slant, some part of the battery will be sheltered by the pillars. One meter battery exposed in the vertical sunlight for one hour will generate one unit of energy. If the sunlight is slant, the amount of energy generated should be multiplied by sin¦Â (¦Â is the angle between sunlight and horizontal line). The sun rises from the infinite far left end of the horizon at 6 o¡¯clock and goes down at the infinite far right end of the horizon at 18 o¡¯clock. The sun is always infinite far away. So the sunlight is parallel, and ¦Â is ¦Ð/2 at 12 o¡äclock. Please calculate the amount of energy generated by the battery between t1 o¡¯clock and t2 o¡¯clock (6 ¡Üt1<t2¡Ü18 ). Input There are multiple test cases. For each test case£º The first line contains two integer L(10¡ÜL¡Ü100,000) andN(4¡ÜN¡Ü1000), indicating the length of the battery and the number of pillars. The second line contains two integers, above mentioned t1 and t2(6 ¡Üt1<t2¡Ü18 ). Then N lines follow, each containing two integers Xi(0¡ÜXi¡ÜL) and Hi(1¡ÜHi¡Ü1000), indicating the position and height of a pillar. It is guaranteed that no two pillars will be in the same position. It is also guaranteed that there is a pillar on both end of the battery. The input end with L=0, N=0. Output For each test case, you should output a line with the energy described above. Output should be rounded to 5 digits after decimal point. Sample Input
Sample Output
Source | ||||||||||
|