码迷,mamicode.com
首页 >  
搜索关键字:动态规划    ( 6061个结果
Interleaving String
Interleaving String问题:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.思路: dfs肯定能解决 但是肯定会超时 动态规划方程dp[i][j] == true only dp[i-1][.....
分类:其他好文   时间:2015-03-27 23:47:06    阅读次数:232
LeetCode[Dynamic Programming]: Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.  For example, given the array [2,3,-2,4],  the contiguous subarray [2,3] has the largest ...
分类:其他好文   时间:2015-03-27 22:28:08    阅读次数:211
分治法、动态规划、回溯法、分支界限法、贪心算法
转:http://blog.csdn.net/lcj_cjfykx/article/details/41691787分治算法一、基本概念 在计算机科学中,分治法是一种很重要的算法。字面上的解释是“分而治之”,就是把一个复杂的问题分成两个或更多的相同或相似的子问题,再把子问题分成更小的子问题……直到最...
分类:编程语言   时间:2015-03-22 01:40:13    阅读次数:299
动态规划 0-1背包问题
01背包问题,是用来介绍动态规划算法最经典的例子,这篇文章力争做到用最简单的方式,最少的公式把01背包问题讲解透彻。(能够从底向上递推的重要原因就是:最优子结构+无后效性)01背包的状态转换方程f[i,j] = Max{ f[i-1,j-Wi]+Pi( j >= Wi ), f[i-1,j] }f[...
分类:其他好文   时间:2015-03-21 22:51:43    阅读次数:212
【LeetCode】Interleaving String 解题报告
【题目】 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbb...
分类:其他好文   时间:2015-03-21 20:03:14    阅读次数:124
蓝桥杯 - 买不到的数目 (动态规划 + 数论)
历届试题 买不到的数目   时间限制:1.0s   内存限制:256.0MB        问题描述 小明开了一家糖果店。他别出心裁:把水果糖包成4颗一包和7颗一包的两种。糖果不能拆包卖。 小朋友来买糖的时候,他就用这两种包装来组合。当然有些糖果数目是无法组合出来的,比如要买 10 颗糖。 你可以用计算机测试一下,在这种包装情况下,最大不能买到的数量...
分类:其他好文   时间:2015-03-21 17:14:19    阅读次数:543
BZOJ 2024 SHOI2009 舞会 动态规划+容斥原理+高精度
题目大意:给定两个序列,求有多少个匹配满足a[i] 见http://blog.csdn.net/popoqqq/article/details/44514113 高精度已废。。。 #include #include #include #include #include #define M 202 using namespace std; struct Big_Int{ #defi...
分类:其他好文   时间:2015-03-21 17:13:34    阅读次数:279
BZOJ 3622 已经没有什么好害怕的了 动态规划+容斥原理
题目大意:给定两个长度为n个序列,保证这2n个数字两两不同,求有多少匹配满足a[i]>b[i]的数对数比a[i] もう何も怖くない 题解:http://www.cnblogs.com/dyllalala/p/3900077.html OTZ 神思路根本就是想不到啊QAQ でも。。。もう何も怖くない。。。(大雾 此外我们可以引入一下WTY公式: C[i][j]=C[i-1][j]*...
分类:其他好文   时间:2015-03-21 12:45:32    阅读次数:118
【LeetCode】【C++】Wildcard Matching
题目‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).The function prototype should...
分类:编程语言   时间:2015-03-21 12:43:07    阅读次数:190
动态规划小练习
#include using namespace std; #define maxn 105 int w[maxn], v[maxn], dp[maxn][maxn * maxn]; int W, n; int main() { while(cin>>n>>W) { memset(dp, 0, sizeof(dp)); for(int i=0...
分类:其他好文   时间:2015-03-21 09:53:52    阅读次数:150
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!