问题1434--Area

1434: Area

时间限制: 1 Sec  内存限制: 128 MB
提交: 7  解决: 0
[提交] [状态] [讨论版] [命题人:]
题目描述

  There are some circles and squares on the plane. The center of the circles and squares are all on the X-axis. Squares have two types. First type, two of the edges parallel with X-axis, and the other two edges are vertical to the X-axis. Second type, one of the diagonal is on the X-axis, and the other diagonal is vertical to the X-axis. Now, give you the circles and squares, can you tell me the area of all circles and square covered the plane?

输入

The first line of the input is an integer T representing the number of the test cases.(T <= 50)
For each test case, the first line will contain one integer N representing the number of circles and squares. (N <= 10)
The following N lines, each line contain a character ‘A’ or ‘B’ or ‘C’, and two nonnegative integers X, D, descriping a circle or a square. Character ‘A’ means this is a first type square, and the coordinate of the square’s center is (X, 0), and the length of the edge is D. Character ‘B’ means this is a second type square, and X, D has the same meaning. Character ‘C’ means this is a circle, and the coordinate of the circle’s center is (X, 0), and the length of the radius is D. (All the nonnegative integers are no more then 10, see the sample input for more details)

输出

Output one line contain one integer representing the area of all circles and square covered the plane, round to integer.

样例输入 Copy
2
2
C 0 5
A 5 10
2
A 0 10
B 5 10
样例输出 Copy
139
154
来源/分类