dp
文章平均质量分 67
czjxy881
这个作者很懒,什么都没留下…
展开
-
poj 1192 最优联通子集 简单dp
看起来和图相关,其实就是个简单dp,就和取最大连续和一样,只是在一颗树中取…… 有人说是树状dp,我也不知道是不是 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include #incl原创 2013-05-07 00:55:24 · 769 阅读 · 0 评论 -
hdu 1078 FatMouse and Cheese 记忆化搜索
一开始打算正向用状态dp,结果果断超时,换成反向记忆话搜索就过了 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include #include #include #include #incl原创 2013-05-07 18:17:33 · 590 阅读 · 0 评论 -
uva 103 - Stacking Boxes DAG最长路
图很小,所以随便乱搞就可以了,记忆化搜索 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include #include #include #include #include #define INF原创 2013-07-25 01:16:13 · 656 阅读 · 0 评论 -
uva 111 - History Grading LCS
一开始想拿它联系下nlogn的lcs,结果发现n^2才0.022s就算了,nlogn是把LCS编程LIS,然后二分查找 注意输入形式 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #includ原创 2013-07-25 01:07:10 · 596 阅读 · 0 评论 -
uva 10635 - Prince and Princess LCS
利用重新编号将LCS变成LIS,即将第一个重新编号成1-n,在第二个中找LIS /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include #include #include #include原创 2014-01-22 16:04:45 · 672 阅读 · 0 评论 -
uva 11825 - Hackers' Crackdown dp
题意 有n个节点,每个节点有m_i个邻居,每个人和邻居为一个整体,问最多可以分成几组使得每组并集合为全集 转移方程 复杂度 3^n /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include原创 2014-01-28 16:48:31 · 1450 阅读 · 0 评论 -
uva 10891 - Game of Sum
题意: A,B两人依次从数组两边拿数字,每次任选一边拿走1+个,A先手,问最后A比B大多少 设代表i,j子序列先手可以取得的最大差值 转移方程为 有个状态,个转移,总复杂度为结果为f(1,n) 也可设f(i,j)为子序列和,则结果为2f(1,n)-sum(n) 转移方程为 f(i,j)=sum(i,j)-min{d(i+1,j)................} 利原创 2014-01-28 12:19:30 · 779 阅读 · 1 评论 -
poj 1157 LITTLE SHOP OF FLOWERS dp
几个月没碰过算法,现在完全不会了。 再过几周就要考试了,抓紧时间恢复一下 这是个简单dp,yi'zhi原创 2014-08-15 20:19:54 · 608 阅读 · 0 评论