码迷,mamicode.com
首页 >  
搜索关键字:滚动数组    ( 315个结果
POJ2442——Squence(二叉堆+动态规划 | 滚动数组)
本文出自:http://blog.csdn.net/svitter 题意分析: Given m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It's clear ...
分类:其他好文   时间:2014-08-03 12:54:15    阅读次数:912
hdu--1421--dp&&滚动数组
每个dp 没个30来分钟 tm的就写不出什么状态转移方程 还是太弱了啊=-= touch me其实用滚动数组 就是看你上一个状态转移到当前状态 与 i 前面多少个有关系 因为这里需要用到 i - 2 i - 1那么其实只要用 i % 3就可以了像上一题 我们只涉及到 i + 1那么只...
分类:其他好文   时间:2014-08-02 12:20:33    阅读次数:256
[ACM] HDU 4576 Robot (概率DP,滚动数组)
Robot Problem Description Michael has a telecontrol robot. One day he put the robot on a loop with n cells. The cells are numbered from 1 to n clockwise. At first the robot is in ce...
分类:其他好文   时间:2014-08-01 19:55:22    阅读次数:319
HDU 4906 Our happy ending (状压DP)
HDU 4906 Our happy ending 题目链接 题意:给定n个数字,每个数字可以是0-l,要选其中一些数字,然后使得和为k,问方案 思路:状压dp,滚动数组,状态表示第i个数字,能组成的数字状态为s的状态,然后每次一个数字,循环枚举它要选取1 - min(l,k)的多少,然后进行状态转移 代码: #include #include typedef ...
分类:移动开发   时间:2014-08-01 02:29:11    阅读次数:392
HDU - 2294 Pendant (DP滚动数组降维+矩阵快速幂)
Description On Saint Valentine's Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of pearls, and its length is defined a...
分类:其他好文   时间:2014-07-30 17:30:44    阅读次数:349
POJ 1159 Palindrome(lcs加滚动数组)
lcs算法 加 滚动数组 注释详...
分类:其他好文   时间:2014-07-30 12:23:53    阅读次数:269
动态规划+滚动数组 -- POJ 1159 Palindrome
给一字符串,问最少加几个字符可以让它成为回文串 比如 Ab3bd 最少需要两个字符可以成为回文串 dAb3bAd 思路: 动态规划 DP[i][j] 意味着从 i 到 j 这段字符变为回文串最少要几个字符,枚举子串长。 if str[i] == str[j]: DP[i][j] = DP[i + 1][j - 1] else: DP[i][j] = min( DP[i +...
分类:其他好文   时间:2014-07-19 02:35:45    阅读次数:198
POJ - 3624 Charm Bracelet
01背包,DP简答题就行,要用滚动数组,不然内存要爆。for循环的方向很重要,虽然是简单题,但对理解DP帮助很大,听队长说要把每一个状态写出来,我试着写了一下,果然更容易理解了。 1 #include 2 #include 3 #define doumax(a,b) (a>b?a:b) 4 cons...
分类:其他好文   时间:2014-07-18 09:23:32    阅读次数:181
动规之区间动规小结
区间动规主要有两种方法: 一、是先想出递归式,然后将之转化为滚动数组。 二、或者从小区间贪到大区间。 POJ 1159  点击打开链接 AC代码如下: #include #include #include using namespace std; char a[5005]; short dp[5005][5005]; int min(int a,int b) { retu...
分类:其他好文   时间:2014-07-14 14:01:43    阅读次数:187
HDU 1171 Big Event in HDU
也是多重背包可行性问题。时间复杂度为 O(VN); V=背包容量,N=物品数量。 题意是说给你N个物品,每个物品有不同的价值与数量。分给两个院。 问你怎么分配才让能让价值尽量相等。 跟我上一篇解题报告是一种类型。以价值为费用,总价值的一半为背包容量。 不过物品有点多,直接开数组可能会超内存。我就用了滚动数组。 需要注意的是 you should guarant...
分类:其他好文   时间:2014-07-13 15:45:40    阅读次数:208
315条   上一页 1 ... 29 30 31 32 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!