漂浮法,顾名思义,就是一块块的往上飘。
以逆序来进行放置,即n to 1。逆序的好处在于放置一个矩形后,俯视看到的就是最终俯视该矩形应该看到的。因为挡着它的矩形在之前已经放置好了,所以可直接统计,为递归创造了条件。每放一个矩形,可以想象成将其扔入一密度很大的海水底部,海分成了n层,然后矩形开始向上浮。在上浮过程中若碰撞到其他的矩形则断裂成几个小矩形,继续上浮,直到浮出水面。于是想到用个递归来模拟...
Problem Description:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in th...
分类:
其他好文 时间:
2014-07-07 16:20:26
阅读次数:
216
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region...
分类:
其他好文 时间:
2014-06-30 15:03:43
阅读次数:
209
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1147
题意:一个10000*10000的矩阵,初始颜色都为1,然后最多2500次涂色,每次涂色将一个矩形的面积涂成某个特定颜色,问涂完之后每种颜色最终的面积。
解法:
代码:/*********************************************...
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region...
分类:
其他好文 时间:
2014-06-28 18:03:06
阅读次数:
238
【题目】
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.
A region is captured by flipping all 'O's into 'X's in that surrounded region.
For example,
X X X X
X O O X
X X O X
X O X X
After running your function, the board shou...
分类:
其他好文 时间:
2014-06-25 08:02:30
阅读次数:
205
意外发现的文章,等忙完这阵子,准备全都翻译出来!
==============================================
原作者文章链接:http://www.homolog.us/blogs/blog/2011/08/09/de-bruijn-graphs-for-alter...
分类:
其他好文 时间:
2014-05-23 09:15:40
阅读次数:
303
1、
??
Surrounded Regions
Given a 2D board containing 'X' and 'O',
capture all regions surrounded by 'X'.
A region is captured by flipping all 'O's into 'X's
in that surrounded region.
For e...
分类:
其他好文 时间:
2014-05-11 18:52:32
阅读次数:
293
1.在AndroidSDKToolr19之后,Export的时候遇到xxxisnottranslatedinyyy,zzz的问题。例如说"auto_exit"isnottranslatedinzh,zh_CN.这是因为AndroidSDKTool將ANDROID_LINT_COMPLETE_REGIONS改为了需要检查。临时解决方法:Eclipse>Preference>Android>LintErrorChecking..
分类:
系统相关 时间:
2014-05-06 20:12:38
阅读次数:
479
Abstract. In mathematics a Voronoi diagram is a
way of dividing space into a number of regions. A set of points, called seeds,
sites, or generators is...
分类:
其他好文 时间:
2014-05-01 09:46:54
阅读次数:
493