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

CodeForces 660E – Different Subsets For All Tuples [DP]


Link 传送门 Problem For a sequence a of n integers between 1 and m, inclusive, denote f(a) as the number of distinct subsequences of a (including the empty subsequence). You are given two positive integers n and m. Let S be the set of all sequenc...

CodeForces 660E – Different Subsets For All Tuples [DP]

Link 传送门 Problem For a sequence a of n integers between 1 and m, inclusive, denote f(a) as the number of distinct subsequences of a (including ...
阅读全文 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

POJ 2151 – Check the difficulty of problems [概率DP]


Link 传送门 Problem Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect the contest result satisfy the following two terms: 1. All of the teams solve at least one problem. 2...

POJ 2151 – Check the difficulty of problems [概率DP]

Link 传送门 Problem Organizing a programming contest is not an easy job. To avoid making the problems too difficult, the organizer usually expect t...
阅读全文 0

UVa 1424 – Salesmen [DP]


Link 传送门 Mean 给定一个N个点M条边的无向图,一个人走出了一个路径,但这个路径有可能是不对的,例如图上并没有某条边。给你这个路径,让你再找出一条等长的路径,使得两条路径的距离最近。 路径的距离定义如下:每个点相同为0,不同为1. Analysis 比较简单的dp,...

UVa 1424 – Salesmen [DP]

Link 传送门 Mean 给定一个N个点M条边的无向图,一个人走出了一个路径,但这个路径有可能是不对的,例如图上并没有某条边。给你这个路径,让你再找出一条等长...
阅读全文 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