2900. Alien Visit

单点时限: 3.0 sec

内存限制: 256 MB

25 May, 1997, near Elcino-Borisovo place, Jandal region, strange signs were found in the field…

Witness: “First, I saw only one UFO. It was shining with cold-blue light. Closer to the center of the object, the light was pink. It hung over the field, then began to blink and move intermittently round. The UFO was quite big. The second UFO came several minutes after the first. It had the same size as the first one. It seemed that there was some kind of contact between them — they began to blink alternately.”

Circles of scorched barley were found in the field. The circles were of the same radius, and their centers were lying on a straight line.

You were hired to investigate the damage caused to the farms of Elcino-Borisovo place by the visit of aliens. In order to do this you are to calculate the total area of scorched barley.


The first line of the input contains two integers $n$ and $r$ denoting number of circles and the radius of the circles, respectively $(1 \le n \le 1~000, 1 \le r \le 100)$. The next line contains $n$ space separated integers $a_1,a_2,\ldots,a_n$; the shifts of circles’ centers relative to some origin $(0 \le a_i \le 5~000)$. All shifts are guaranteed to be distinct.


Output the only real number — the total area covered by these circles. The relative error of your answer must not exceed $10^{-6}$.


1 1
2 2
0 2

31 人解决,44 人已尝试。

52 份提交通过,共有 179 份提交。

4.8 EMB 奖励。

创建: 9 年,8 月前.

修改: 3 年,3 月前.

最后提交: 2 月前.

来源: N/A