问题2233--Untidy Desktops

2233: Untidy Desktops

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

Many companies are moving towards \paperless oces" in an attempt to increase productivity. Unfortunately, people who are unorganized with papers are unorganized without papers too! Instead of having piles of paper scattered all over a desk, people have windows overlapping and covering one another. For these people, nding the right window on the computer screen is just as hard as finding the right piece of paper on the desk. For this problem, you will be given the locations and sizes of n windows on a computer desktop (1 <= n <= 50). You have been asked to evaluate how untidy the computer desktop is by counting the number of windows that overlap with at least one other window. Two windows overlap if at least one pixel is in both windows (including the boundary of the windows).

输入

The input will consist of multiple cases. Each case will start with a line containing a single integer n. This will be followed by n lines of the form r c w h where r, c are the row and column coordinates of the upper left corner of the window, and w, h are the width and height of the window. You may assume that the upper left corner of the computer desktop has coordinates (0,0), the screen has 1024 rows and 1280 columns, and all windows are completely within the boundary of the screen. A value of n = 0 will terminate the input.

输出

For each test case, print on a single line the number of windows that overlap with at least one other window.

样例输入 Copy

3
0 0 20 20
20 20 20 20
40 40 20 20
5
0 0 20 20
18 18 20 20
40 40 20 20
5 10 4 2
100 100 40 40
0

样例输出 Copy

0
3

来源/分类