/ OPS / 题库 /

Counting Squares

Counting Squares

#描述#
Your input is a series of rectangles, one per line. Each rectangle is specified as two points (X,Y) that specify the opposite corners of a rectangle. All coordinates will be integers in the range 0 to 100. For example, the line<br>
5 8 7 10<br>
specifies the rectangle who's corners are (5,8), (7,8), (7,10), (5,10).<br>
If drawn on graph paper, that rectangle would cover four squares. Your job is to count the number of unit (i.e., 1*1) squares that are covered by any one of the rectangles given as input. Any square covered by more than one rectangle should only be counted once.

#格式#
##输入格式##
The input format is a series of lines, each containing 4 integers. Four -1's are used to separate problems, and four -2's are used to end the last problem. Otherwise, the numbers are the x-y coordinates of two points that are opposite corners of a rectangle.

##输出格式##
Your output should be the number of squares covered by each set of rectangles. Each number should be printed on a separate line.

#样例1#
##样例输入1##

5 8 7 10
6 9 7 8
6 8 8 11
-1 -1 -1 -1
0 0 100 100
50 75 12 90
39 42 57 73
-2 -2 -2 -2

##样例输出1##

8
10000

#限制#
1000ms
32768KB

#提示#

#来源#

信息

ID
1108
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者