当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1264: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
5 8 7 10
specifies the rectangle who's corners are(5,8),(7,8),(7,10),(5,10).
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-ycoordinates 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.
输入样例
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
输出样例
8
10000
来自杭电HDUOJ的附加信息
Recommend JGShining

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1264

最后修改于 2020-10-25T22:43:24+00:00 由爬虫自动更新

共提交 3

通过率 100.0%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)