P25490 [AtCoder] [ABC026B] N重丸
入门
题目描述

Problem Description

Takahashi loves circles. Today, he drew $N$ circles with different sizes centered at the origin.

For this set of circles, calculate the area of the parts painted red when coloring them alternately from the outermost circle in red and white.

Input Format

The input is given from the standard input in the following format:

$ N $ $ R_1 $ $ R_2 $ : $ R_N $

  • The first line contains an integer $ N(1≦N≦1000) $, representing the number of circles.
  • The next $ N $ lines contain $ N $ integers, each representing the radius of a circle. The $ i $th line contains an integer $R_i\ (1\ ≦\ R_i\ ≦\ 1000)$, which is the radius of the $ i $th circle.
  • When $i\ ≠\ j$, $R_i\ ≠\ R_j$ is satisfied.

Output Format

Output the area of the parts painted red in one line. The answer will be accepted if the relative or absolute error is within $ 10^{-6} $.

End the output with a newline.

Sample Input and Output

Sample Input #1

3
1
2
3

Sample Output #1

18.8495559215

Sample Input #2

6
15
2
3
7
6
9

Sample Output #2

508.938009881546

Notes/Hints

Sample Explanation 1

With the given input, the coloring will be as described in the problem statement. The area of the red parts is $(3^2\ -\ 2^2\ +\ 1^2)\ ×\ π\ ≒\ 18.8495559215$.

Sample Explanation 2

Note that the input may not be sorted by radius.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 2 3
样例输出
18.8495559215