Nội dung Bài tập
Mã:
TRIANGLE
Tên:
Diện tích phủ các tam giác vuông cân
Dạng thi:
oi
Thang điểm:
10 điểm
Giới hạn thời gian:
1 giây
Giới hạn bộ nhớ:
256 MB
Được tạo bởi:
phuc

There are given n isosceles right triangles on a plane. Each triangle can be described by three integers x,y,m (m>0). Vertices of such a triangle are points which have coordinates (x;y), (x+m;y) and (x; y+m).

Write a program which calculates the total area covered by triangles.

Input data

The first line of the input contains one positive integer n (n £ 2000), the number of triangles on a plane.

The next n lines of the file describe the triangles, one triangle per line. Each line contains three integers xi, yi and mi, separated by single spaces (1 £ i £ n, ‑107 £ xi £ 107, ‑107 £ yi £ 107, 0 < mi £ 1000).

Output data

One number with exactly one digit after decimal point must be written – the total area covered by triangles.

Example

InputOutput
5
-5 -3 6
-1 -2 3
0 0 2
-2 2 1
-4 -1 2
24.5




Cho N tam giác vuông cân . Hãy tính diện tích miền bị phủ bởi N tam giác này .

Input
Dòng 1 : số nguyên N ( 1 ≤ N ≤ 2000 ) . 
N dòng tiếp theo , mỗi dòng gồm 3 số nguyên xi , yi , mi ( -10^7 ≤ xi , yi ≤ 10^7 , 1 ≤ mi ≤ 1000 ) mô tả toạ độ tam giác thứ i , 3 đỉnh tam giác i sẽ có toạ độ (xi,yi) , (xi+mi,yi) , (xi,yi+mi) .

Output
Gồm 1 dòng duy nhất ghi ra diện tích miền bị phủ (lấy đúng 1 chữ số thập phân) .

Ví dụ:

InputOutput
5
-5 -3 6
-1 -2 3
0 0 2
-2 2 1
-4 -1 2
24.5



    Quảng cáo
       Ngôn ngữ : 

       Theme : 
Mời bạn soạn code



		



      Ai có thể xem bài này : 

Thông tin



Phần thảo luận