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
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
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
【题目】
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
题目大意:给定两个序列,求有多少个匹配满足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
题目大意:给定两个长度为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
题目‘?’ 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