There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f...
分类:
其他好文 时间:
2015-10-10 09:06:22
阅读次数:
307
题目链接:http://poj.org/problem?id=3253单调队列和优先队列(哈夫曼编码)分别实现: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #includ...
分类:
其他好文 时间:
2015-10-06 15:21:51
阅读次数:
216
Fence RepairTime Limit:2000MSMemory Limit:65536KTotal Submissions:33128Accepted:10702DescriptionFarmer John wants to repair a small length of the fenc...
分类:
其他好文 时间:
2015-10-04 22:16:23
阅读次数:
197
这种有小数的题目总会令我格外头疼。/*ID: modengd1PROG: fence9LANG: C++*/#include #include #include #include using namespace std;long long ans,x1,x2;int n,m,p;int main()...
分类:
其他好文 时间:
2015-09-28 10:01:15
阅读次数:
180
Fence RepairTime Limit:2000MSMemory Limit:65536KTotal Submissions:32916Accepted:10638点我DescriptionFarmer John wants to repair a small length of the fe...
分类:
其他好文 时间:
2015-09-18 00:45:36
阅读次数:
162
懒省事的小明时间限制:3000ms | 内存限制:65535KB难度:3描述 小明很想吃果子,正好果园果子熟了。在果园里,小明已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。小明决定把所有的果子合成一堆。 因为小明比较懒,为了省力气,小明开始想点子了: 每一次合并,小明可以把两堆果子....
分类:
其他好文 时间:
2015-09-18 00:37:10
阅读次数:
202
题目链接:codeforces 448C题目大意:给出n个杆子,每个杆子有一个长度,每次可以刷一行或一列,问最少刷多少次可以将整个墙刷成黄色。题目分析:
首先我们能够想到,如果横着刷,为了得到最优解,当前刷的位置的下面也必须横着刷,然后对于每种情况都可以通过n次竖着刷得到整个黄色的墙。
所以我们采取分治的策略进行动态规划,也就是对于每个状态划分为两种情况讨论,如果要刷横向的话,最矮要刷到最矮的柱子的...
分类:
其他好文 时间:
2015-09-16 14:19:09
阅读次数:
358
Problem:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two ad...
分类:
其他好文 时间:
2015-09-10 07:18:31
阅读次数:
328
Fence Repair 问题大意:农夫约翰为了修理栅栏,要将一块很长的木块切割成N块,准备切成的木板的长度为L1,L2...LN,未切割前的木板的长度恰好为切割后木板的长度的总和,每次切断木板的时候,需要的开销为这块木板的长度,例如长...
分类:
其他好文 时间:
2015-09-06 21:32:18
阅读次数:
230
Paint FenceThere is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two...
分类:
其他好文 时间:
2015-09-06 12:31:55
阅读次数:
134