题目链接:http://codeforces.com/problemset/problem/525/D
题意:n*m的格子,‘*’代表墙壁,‘.’代表房间,要求房间都必须是矩形,输出改动后的 n*m;
思路:看了官方题解,思路蛮巧妙的。因为要求一定是矩形,所有在每个2*2的格子里,若有3个‘.’和1个‘*’,那么就将‘*’改成‘.’,这样就能确保房间一定是矩形了。
代码如下:
#inclu...
分类:
其他好文 时间:
2015-07-07 09:29:24
阅读次数:
109
题意:有n个桌腿,要砍掉某些桌腿使得剩下的桌腿能支撑桌子。规定剩下的桌腿中长度最大的桌腿的数量如果超过一半即可支撑桌子。砍掉每个桌腿需要付出代价。求最小的代价和。
枚举。假如最后剩下的桌腿的最大长度为lenth,这样长度的桌腿有num个。那么长度大于lenth的桌腿肯定都被砍去了,然后在剩下的桌腿中按照代价从大到小选择num - 1个桌腿留...
分类:
其他好文 时间:
2015-07-01 10:10:58
阅读次数:
270
什么是机器学习?在1959年,Arthur Samuel:不用编程去指定机器做什么,而是让机器有能力自己学习;在1998年,Tom Mitchell:首先定义任务T,经验E,表现P,如果机器有一个任务T,随着经验E的增多,表现P也会变好,则表示机器正在经验E中学习;以上就是对机器学习的两个定义;机器...
分类:
其他好文 时间:
2015-06-22 17:39:31
阅读次数:
142
HNOI2015 Arthur(思路:期望DP)
HNOI2015 Fruit(思路:DFS序+整体二分+线段树)
HNOI2015 Dishes(思路:优先队列+字典序)
HNOI2015 Maple(思路:DAG上DP)
HNOI2015 Shop(思路:可持久化树分治结构)
HNOI2015 Pairwise(思路:树形DP)...
分类:
其他好文 时间:
2015-06-10 22:38:35
阅读次数:
242
Problem DescriptionYou are building a house. You’d prefer if all the walls have a precise right angle relative to the ground, but you have no device t...
分类:
其他好文 时间:
2015-06-06 19:36:02
阅读次数:
111
3177 - Beijing Guards
Time limit: 3.000 seconds
Beijing was once surrounded by four rings of city walls: the Forbidden City Wall, the Imperial City Wall, the Inner City Wall, and finally the Outer Ci...
分类:
其他好文 时间:
2015-06-04 01:04:38
阅读次数:
330
Problem Description
Sakura has a very magical tool to paint walls. One day, kAc asked Sakura to paint a wall that looks like an M×N matrix. The wall has M×N squares in all. In the whole problem we den...
分类:
其他好文 时间:
2015-05-28 14:08:27
阅读次数:
89
题目传送门 1 /* 2 题意:问最少替换'*'为'.',使得'.'连通的都是矩形 3 BFS:搜索想法很奇妙,先把'.'的入队,然后对于每个'.'八个方向寻找 4 在2*2的方格里,若只有一个是'*',那么它一定要被替换掉 5 */ 6 #include 7 #i...
分类:
其他好文 时间:
2015-05-27 22:38:45
阅读次数:
187
1.what is machine learning?机器学习的定义
Arthur Samuel (1959). Machine Learning: Field of study that gives computers the ability to learn without being explicitly programmed.
Tom Mitchell (1998) Well-pose...
分类:
其他好文 时间:
2015-05-23 10:06:16
阅读次数:
300