Vijos P1987 – 游戏 [贪心]


Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于a且不大于b的整数t,并告诉小可可这个数字t是多少。之后小可可会挑出恰好k张卡片,并将这k张卡片上的数字相...

Vijos P1987 – 游戏 [贪心]

Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于...
阅读全文 0

HDU 2340 – Obfuscation [DP]


Link http://acm.hdu.edu.cn/showproblem.php?pid=2340 Problem It is a well-known fact that if you mix up the letters of a word, while leaving the first and last letters in their places, words still remain readable. For example, the sentence “tihs sn...

HDU 2340 – Obfuscation [DP]

Link http://acm.hdu.edu.cn/showproblem.php?pid=2340 Problem It is a well-known fact that if you mix up the letters of a word, while leaving the fir...
阅读全文 0

HDU 4336 – Card Collector [状压概率DP]


Link http://acm.hdu.edu.cn/showproblem.php?pid=4336 Problem In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in the famous novel Water Margin, you will...

HDU 4336 – Card Collector [状压概率DP]

Link http://acm.hdu.edu.cn/showproblem.php?pid=4336 Problem In your childhood, do you crazy for collecting the beautiful cards in the snacks? They ...
阅读全文 0

HDU 2089 – 不要62 [数位DP]


Link 传送门 Problem 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为...

HDU 2089 – 不要62 [数位DP]

Link 传送门 Problem 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含...
阅读全文 0

HDU 1158 – Employment Planning [DP]


Link 传送门 Problem A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When he hires or fires a worker, there will be some extra cost. Once a w...

HDU 1158 – Employment Planning [DP]

Link 传送门 Problem A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the wo...
阅读全文 0

HDU 5642 – King’s Order [数位DP]


Link 传送门 Problem After the king’s speech , everyone is encouraged. But the war is not over. The king needs to give orders from time to time. But sometimes he can not speak things well. So in his order there are some ones like this: “...

HDU 5642 – King’s Order [数位DP]

Link 传送门 Problem After the king’s speech , everyone is encouraged. But the war is not over. The king needs to give orders from time to tim...
阅读全文 0

51nod 1270 – 数组的最大代价 [DP]


Link 传送门 Problem 数组A包含N个元素A1, A2……AN。数组B包含N个元素B1, B2……BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <= Bi。数组A的代价定义如下: (公式表示所有两个相邻元素的差的绝对值之和) 给出数组B,计算可能的最...

51nod 1270 – 数组的最大代价 [DP]

Link 传送门 Problem 数组A包含N个元素A1, A2……AN。数组B包含N个元素B1, B2……BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <...
阅读全文 0

UVa 10534 – Wavio Sequence [DP水题]


Link 点击打开UVa题目链接 Mean 给定一个长度为N的整数序列,求一个最长子序列(不一定连续),使得该序列的长度为2K+1,前K+1个数严格递增,后K+1个数严格递减。 Analyse 最长上升子序列的变形,正反求两边,然后再扫一遍即可,具体看代码吧。时间复杂度为O(N*logN)...

UVa 10534 – Wavio Sequence [DP水题]

Link 点击打开UVa题目链接 Mean 给定一个长度为N的整数序列,求一个最长子序列(不一定连续),使得该序列的长度为2K+1,前K+1个数严格递增,后K+1个数严格递...
阅读全文 0

ZOJ 2317 – Nice Patterns Strike Back [DP+矩阵+Java大数]


Link 点击打开zoj题目链接 Problem You might have noticed that there is the new fashion among rich people to have their yards tiled with black and white tiles, forming a pattern. The company Broken Tiles is well known as the best tiling company in o...

ZOJ 2317 – Nice Patterns Strike Back [DP+矩阵+Java大数]

Link 点击打开zoj题目链接 Problem You might have noticed that there is the new fashion among rich people to have their yards tiled with black and wh...
阅读全文 0

UESTC 1217 – The Battle of Chibi [DP+树状数组+离散化]


Link 点击打开usetc题目链接 Problem Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to beat Cao Cao is to have a spy in Cao Cao’s army. But all generals and soldi...

UESTC 1217 – The Battle of Chibi [DP+树状数组+离散化]

Link 点击打开usetc题目链接 Problem Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thoug...
阅读全文 0