编程介的小学生 2017-10-17 08:08 采纳率: 20.5%
浏览 1391
已采纳

End of Windless Days

Description

Jiajia went back to his little hometown for Spring Festival. Due to the poverty of the town, Jiajia was unable to see Wind or hear her voice through QQ for 5 days. You know, that was terrible to Jiajia, so he could only sleep a lot, hopping to see Wind in wonderful dreams.

Finally, Jiajia was in the airport, so he will soon be able to see his honey, Wind. Again, he decided a dream another dream, to spend the boring time in the waiting room. But this time he was unable to sleep, since there was a super light hanging in the ceiling, and the light was too strong to sleep in. Luckily, Jiajia found that there are some curtains somewhere below the light, blocking some rays. The floor and curtains are rectangular-shaped. The planes in which a curtain lies in are parallel to the floor, and when projected to the floor, the sides of curtains are parallel to those of the floor.

Jiajia is interested in the total area on the floor covered by the light, could you write a program to do this? Jiajia would be very happy if he receives this program as a special gift, at the end of windless days.
Input

The first line contains a single integer n, the number of curtains. The second line contains four integers minx,miny,maxx,maxy, where minx < maxx, miny < maxy. That means the floor lies in range [minx,miny]-[maxx,maxy]. The floor has a height of 0. The third line contains three integers lx, ly, lh, that is the position of the super light.

The following n lines each has 5 integers x1,y1,x2,y2,h, where minx < x1 < x2 < maxx, miny < y1 < y2 < maxy, 0 < h < lh. This means the curtain lies in range [x1,y1]-[x2,y2], the height of the curtain is h.

You may assume that n<=500, every other numbers in the input do not exceed 20000 in absolute value. If two numbers differ at most 10-6, they are considered to be equal. Be careful that there may be many many cases.
Output

The output contains a single real number, the total area on the floor covered by the light. The answer should be rounded to 4 decimal places.
Sample Input

2
-10 -10 10 10
0 0 2
0 0 5 5 1
-5 -5 0 0 1
Sample Output

200.0000

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-01 15:46
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名