| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 804 人关注过本帖
标题:题目我已经翻译了 在三楼 现请教题目的算法
取消只看楼主 加入收藏
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
 问题点数:0 回复次数:3 
题目我已经翻译了 在三楼 现请教题目的算法

Untidy Desktops

Time Limit:10000MS Memory Limit:65536K
Total Submit:0 Accepted:0

Description

Many companies are moving towards “paperless offices" in an attempt to increase productivity. Un-
fortunately, 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 an-other. For these people, finding 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).


Input

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.


Output

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

Sample Input


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


Sample Output


0
3


[此贴子已经被作者于2007-11-2 13:57:01编辑过]

搜索更多相关主题的帖子: 算法 翻译 
2007-10-29 14:13
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
多谢大家的帮忙啊 对于我的问题 你们总是
能给我不同的思路 给我灵感

[此贴子已经被作者于2007-11-2 13:42:42编辑过]


前世五百次的回眸 才换来今生的擦肩而过
2007-10-29 14:36
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
这个题的意思是
比如 第一个用例
3
0 0 20 20
20 20 20 20
40 40 20 20
3表示有三个矩形
其中0 0表示第一个的起始坐标(左上角的那点)
是(0,0)
第一个20表示长度20个单位
第二个20表示宽度20个单位
下面的类似
相当于给我们一组矩形
让我们判断有没有相交部分
输出的0表示没有
3表示3个有
注意顶点相交不算相交





前世五百次的回眸 才换来今生的擦肩而过
2007-11-02 13:50
心剑菩提
Rank: 1
等 级:新手上路
帖 子:249
专家分:0
注 册:2007-5-17
收藏
得分:0 
想过 麻烦如果数据多了还超时

前世五百次的回眸 才换来今生的擦肩而过
2007-11-02 16:05
快速回复:题目我已经翻译了 在三楼 现请教题目的算法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016085 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved