编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)