300821: CF157B. Trace
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Trace
题意翻译
题目描述 一天,夏洛克·福尔摩斯正在跟踪一个重要罪犯时,他在墙上发现了一张美妙的画。这个墙可以被表示成一个平面,墙上有许多同心圆,将平面分成了若干块。除此之外,相邻的两个部分被交错填上了红色和蓝色。其中在所有圆外的部分被填了蓝色。夏洛克想知道红色部分的面积是多少。 输入格式 第一行包含一个整数 n(1≤n≤100)。 第二行包含 n 个整数 ri(1≤ri≤1000),表示每个圆的半径。保证每个圆大小不同。 输出格式 输出一行一个实数,表示红色部分的面积。如果你的答案和标准答案的绝对或相对误差小于 10−4 就被认为正确。 样例 样例输入 1 1 1 样例输出 1 3.1415926536 样例解释 1 只有一个半径为 1 的圆,红色部分是这个圆的内部,面积为 π。 样例输入 2 3 1 4 2 样例输出 2 40.8407044967 样例解释 2 所有圆的外侧为蓝色,第二个第三个圆中间是红色,第一第三个圆中间是蓝色,第一圆内是红色。总面积为 (π×42−π×22)+π×12=12π+π=13π题目描述
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides, any two neighboring parts were painted different colors, that is, the red and the blue color were alternating, i. e. followed one after the other. The outer area of the wall (the area that lied outside all circles) was painted blue. Help Sherlock Holmes determine the total area of red parts of the wall. Let us remind you that two circles are called concentric if their centers coincide. Several circles are called concentric if any two of them are concentric.输入输出格式
输入格式
The first line contains the single integer $ n $ ( $ 1<=n<=100 $ ). The second line contains $ n $ space-separated integers $ r_{i} $ ( $ 1<=r_{i}<=1000 $ ) — the circles' radii. It is guaranteed that all circles are different.
输出格式
Print the single real number — total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed $ 10^{-4} $ .
输入输出样例
输入样例 #1
1
1
输出样例 #1
3.1415926536
输入样例 #2
3
1 4 2
输出样例 #2
40.8407044967