随笔分类 - dp专题
摘要:Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorativ...
阅读全文
摘要:Description Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice have si...
阅读全文
摘要:Description I used to think I could be anything, but now I know that I couldn't do anything. So I started traveling. The nation looks like a connected bidirecti...
阅读全文
摘要:Description In the battlefield , an effective way to defeat enemies is to break their communication system. The information department told you that there are n...
阅读全文
摘要:Description For the hope of a forever love, Steven is planning to send a ring to Jane with a romantic string engraved on. The string's length should not exceed N. The car...
阅读全文
摘要:Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It mea...
阅读全文
摘要:Description ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因,有些城堡不能直接攻克,要攻克这些城堡必须先攻克其他某一个特定的城堡。你能帮ACboy算出要获得尽量多的宝物应该攻克哪M个城堡吗? Input...
阅读全文
摘要:Description It's election time in Berland. The favorites are of course parties of zublicanes and mumocrates. The election campaigns of both parties include numerous demon...
阅读全文
摘要:Description 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图
阅读全文
摘要:Description After coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the ci...
阅读全文
摘要:Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one ...
阅读全文
摘要:Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use...
阅读全文
摘要:最近做到好几道关于AC自动机与状态压缩dp的结合的题,这里总结一下。 题目一般会给出m个字符串,m不超过10,然后求长度为len并且包含特定给出的字符串集合的字符串个数。 以HDU 4758为例: 把题意抽象为:给出两个字符串,且只包含两种字符 'R'、'D',现在求满足下列条件的字符串个数: 1、字符串必须包含上述两个字符串。 2、字符串长度为(m+n),其中包含n个'D',m个'R'...
阅读全文
摘要:这个题目题意描述不清,没有说明只能进入一次。 题目意思很好理解,不再重复。 思路也比较好想,先计算每两个宝藏区的最短路,和每个宝藏区到边界的最短路,然后dp解决。 在计算最短路的时候,用优先队列优化的Dijkstra算法。 在-1的处理上有些小技巧。 但是!但是!!,我之前的思路是dp[i]表示状态
阅读全文
摘要:1021石子归并V1 N堆石子摆成一条线。现要将石子有次序地合并成一堆。规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石子数记为该次合并的代价。计算将N堆石子合并成一堆的最小代价。 例如: 1 2 3 4,有不少合并方法 1 2 3 4 => 3 3 4(3) => 6 4(9) => 10(19) 1 2 3 4 => 1 5 4(5) => 1 9(14) ...
阅读全文
摘要:在m*n的一个长方形方格中,用一个1*2的骨牌排满方格。问有多少种不同的排列方法。(n #include #include #include using namespace std; typedef long long ll; const int mod=1e9+7; ll dp[1n) return; ...
阅读全文

浙公网安备 33010602011771号