luogu#P4515. [COCI2009-2010#6] XOR

[COCI2009-2010#6] XOR

题目描述

坐标系下有若干个等腰直角三角形,且每个等腰直角三角形的直角顶点都在左下方,两腰与坐标轴平行。被奇数个三角形覆盖的面积部分为灰色,被偶数个三角形覆盖的面积部分为白色,如下图所示。 已知 NN个等腰直角三角形的顶点坐标及腰长,求灰色部分面积。

Mirko and Slavko have built their own LED display. The display is initially white. During each of the NN parts of the testing phase, Mirko attached three electrodes to the display in such way that they formed a right isosceles triangle. He noticed that, after attaching the electrodes, all pixels in the enclosing triangle are inverted (white pixels become black, and black pixels become white).

Watching Mirko play with the electrodes, Slavko observed interesting shapes emerging on the screen. Mathematically inclined as he is, first thing that crossed his mind was how to calculate total area covered by black pixels. Help him by writing a program to do just that!

输入格式

输入第一行包含一个整数 NN,表示等腰直角三角形数量。

接下来 NN行,每行三个整数 X,Y,RX, Y, R,分别表示等腰直角三角形的顶点坐标 (X,Y)(X, Y)与腰长 RR

First line of input contains an integer N(1N10)N(1 \leq N \leq 10), number of triangles formed by Mirko's fiddling with electrodes. Each of the following NN lines contains three integers X,YX, Y and R(1X,Y,R106)R (1 \leq X, Y, R \leq 10^6 ), describing a triangle. (X,Y)(X, Y) are the coordinates of the lower left corner of the triangle, while RR represents the length of the two sides of the triangle.

输出格式

输出包含一个实数,表示灰色部分面积。保留1位小数。

The first and only line of output should contain the area covered by black pixels, rounded to one decimal place.

3
1 1 2
7 1 6
5 3 4
24.0
5
5 5 99
5 5 99
5 5 99
5 5 99
5 5 99
4900.5
4
5 5 99
5 5 99
5 5 99
5 5 99
0.0

提示

1N10,1X,Y,R1061 \leq N \leq 10, 1 \leq X, Y, R \leq 10^6