Baltic OI '02 P3 - Triangles

View as PDF

Submit solution


Points: 12 (partial)
Time limit: 1.0s
Memory limit: 256M

Problem types
Baltic Olympiad in Informatics: 2002 Day 1, Problem 3

There are given n isosceles right triangles on a plane. Each triangle can be described by three integers x,y,m. 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.

Constraints

1n2000

|xi|,|yi|107

1mi1000

Input Specification

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

The next n lines describe the triangles, one triangle per line. Each line contains three space-separated integers xi, yi and mi (1in).

Output Specification

Output one number with exactly one digit after the decimal point - the total area covered by triangles.

Sample Input

Copy
5
-5 -3 6
-1 -2 3
0 0 2
-2 2 1
-4 -1 2

Sample Output

Copy
24.5

Comments


  • 0
    d  commented on Nov. 25, 2022, 10:02 a.m.

    Forest Area is a similar problem with higher constraints.