编程介的小学生 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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog