编程介的小学生 2017-09-16 04:41 采纳率: 20.5%
浏览 827
已采纳

Water Ring

After we place a wet cup on the table for a while, we pick it up and could see a water ring made by its buttom. When there are many pieces of paper on the table, some part of the ring will left on the papers instead of table. So, I am curious about the length of water ring left on the paper(the total lengh of the red arc). To make things easier, we assume that each paper is a rectangle and the sides are parallel to axes.


Input

There ara multiply cases (less than 50). Process to the end of file.

The first line of each test case contains two integers R and N (1 <= R <= 1000, 0 <= N <= 50), indicating the radius of the water ring and the number of papers on the table, the center of water ring is always (0,0). Each of the next N lines contains 4 integers x1,y1,x2,y2 (-1000 <= x1 <= x2 <= 1000,-1000 <= y1 <= y2 <= 1000) meaning that the paper is a rectangle that the lower-left point is (x1,y1)and the upper-right point is (x2,y2).

Output

For each test case ,output the length of water ring left on the paper. (accurate to 0.001)

Sample Input

5 1
0 0 4 3
5 1
-5 -5 5 5
10 2
-14 -13 12 -5
5 -9 8 12
Sample Output

0.000
31.416
24.981

  • 写回答

1条回答

  • devmiao 2017-09-30 01:26
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘