[poj2653]Pick-up sticks】的更多相关文章

Pick The Sticks Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 593    Accepted Submission(s): 193 Problem Description The story happened long long ago. One day, Cao Cao made a special order c…
D - Pick The Sticks Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description The story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his point and all became very panic. However, Cao…
Pick The Sticks Time Limit: 15000/10000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) The story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his point and all became v…
D - Pick The Sticks Description The story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his point and all became very panic. However, Cao Cao himself felt very proud of his interesting…
题目:http://poj.org/problem?id=2653 题意:题意很简单,就是在地上按顺序撒一对木棒,看最后有多少是被压住的,输出没有被压住的木棒的序号.(有点坑的就是没说清楚木棒怎么算压住,也不知道是不是规范相交.) 分析: 我的代码是规范相交的情况,怎么说呢这题的数据有点水,我搜了别人的代码,他们都写的是包括不规范相交的情况.不规范相交已补,包括顶点相交 代码: #include <iostream> #include <string.h> #include <…
Time Limit: 15000/10000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit  Status The story happened long long ago. One day, Cao Cao made a special order called "Chicken Rib" to his army. No one got his point and all became ve…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5543 题意:给你一根长为m的长木板和一些小木棒,每一根小木棒有它的长度和价值,这些小木棒要放在长木板上并且每一根小木棒的重心要在长木板上(即可以露出一半的长),问最大价值是多少. dp[i][j][k]  表示前i个小棒放到长度为j的木板上,其中有k个小棒放在边沿部分, 边沿部分的小棒需要尽量放在木板外面(贪心思维),所以放在边沿的木棒落在木板上的长度为l/2.然后就是简单的01背包问题了. tip…
题目传送门 题意:长度为L的金条,将n根金棍尽可能放上去,要求重心在L上,使得价值最大,最多有两条可以长度折半的放上去. 分析:首先长度可能为奇数,先*2.然后除了两条特殊的金棍就是01背包,所以dp[now][j][k]表示当前状态,长度为j,使用了k条特殊金棍获得的最大价值,需要对内存和时间优化. /************************************************ * Author :Running_Time * Created Time :2015/10/2…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5543 题意:往长为L的线段上覆盖线段,要求:要么这些线段都在L的线段上,要么有不超过自身长度一半的部分在线段外面,最多有两条这样的线段(在两头). dp(i,j,k)表示前i个线段覆盖在长度为j的线段上,期中有k个线段不完全在这个线段上的最大价值.考虑线段长度的奇偶问题,所以事先把L和其他线段长度乘2,以便操作.所以枚举所有线段,一般情况,就是01背包的问题,dp(i,j,k)=max(dp(i,j…
题目链接:http://acm.uestc.edu.cn/#/problem/show/1218 给出n根木棒的长度和价值,最多可以装在一个长 l 的容器中,相邻木棒之间不允许重叠,且两边上的木棒,可以伸一半的长度在容器外,求最大价值量 01背包是取和不取.那这里我们可以把容器长度 l x 2,筷子长度 x 2,就变成了最多两个筷子取一次(伸一半在外面),其余的要么取两次,要么不取. 普通01背包,一维dp[i]表示消耗体积i所得到的最大的价值. 那么这里dp[i][k]表示消耗体积i并有k(k…