题目链接:1379 - Pitcher Rotation
题意:n个人,m个敌人,去比赛,有得分,n个人可以重复比,但是每次比完要休息4天,问最大得分
思路:dp[i][j][k][l][x] 表示第场比赛,前一天为j,两天为k,三天为l,四天为x,的最大得分,然后由于只有每个人5天就能用一次,所以对于每个人来说,只有得分前5的会被使用上,所以后4维状态只需要5^4,进行状态转移,不用比赛的情...
分类:
其他好文 时间:
2014-05-07 06:12:51
阅读次数:
308
Description
Farmer John has purchased a lush new rectangular pasture composed of M by
N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of square...
分类:
其他好文 时间:
2014-05-07 05:46:43
阅读次数:
323
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 his toilet paper to draw on,...
分类:
其他好文 时间:
2014-05-07 05:16:29
阅读次数:
385
递归建树,由题知该树是一棵二叉树,且除根节点外其他点的度为0或2。
dp[i][j]表示来到第i个走廊(还未走过这条走廊)还剩下j时间,能拿到最大的画的数量。
dp[i][j]=max(dp[i][j],dp[lson[i]][k]+dp[rson][last_time-k])
#include
#include
using namespace std;
int dp[200][70...
分类:
其他好文 时间:
2014-05-07 05:02:45
阅读次数:
295
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4722
思路:数位dp,dp[i][j]表示到第i位,数字和%10为j,然后进行dp,注意完全匹配的情况是要+1,而其他情况是从0 到 9 都要考虑
代码:
#include
#include
#include
#include
using namespace std;
int t;
l...
分类:
其他好文 时间:
2014-05-07 04:55:37
阅读次数:
314
昨晚Debug了好久始终找不出哪里错了,今早再一看发现自己已荣升逗比Beta 2.0 Version.
个人感觉此题为HDU 4003 的弱化版。
把每棵子树都看成一类商品,在每类商品中至多选一件。则问题转化为最基本的分组背包问题。
dp[s][c][k] c == 1时,表示在s结点不返回时走K的最大收益,c == 0时,表示在s结点重新返回时走k步的最大收益。
可以dfs从底到顶更新d...
分类:
移动开发 时间:
2014-05-07 04:52:22
阅读次数:
500
根据题意,很明显可以推出DP方程。
假如只考虑向左的方向:
dp[t][i][j]: 第t个时间段末滑行到i,j最长滑行的距离。
dp[t][i][j]=dp[t-1][i][1..k]+(j-k)=dp[t-1][i][1..k]-k+j(k
最终时间复杂度为O(n*m*k)
#include
#include
#include
#include
#include
using nam...
分类:
其他好文 时间:
2014-05-07 04:49:13
阅读次数:
363
Collecting Bugs
Time Limit: 10000MS
Memory Limit: 64000K
Total Submissions: 2026
Accepted: 971
Case Time Limit: 2000MS
Special Judge
Description
Ivan is fond o...
分类:
其他好文 时间:
2014-05-07 04:29:43
阅读次数:
450
题目链接:uva 1484 - Alice and Bob's Trip
题目大意:Alice和Bob小两口一起出去旅行,他们从0城市出发,Bob喜欢走比较远的路,因为他是个勤奋的好孩子,Alice喜欢走比较近的路,因为她是一个不勤奋的坏孩子,所以有了意见上的分歧,于是乎在出门前他们约法三章,要求说最后的距离值在[l,r]之间,并且由夫妻两轮流做决定,决定说下一个城市去哪里。现在给出n个...
分类:
其他好文 时间:
2014-05-06 15:16:29
阅读次数:
339