题目:给你两个字符串,求一个最短的串,使得这两个串是目标串的子串。
分析:DP,最大公共子序列。最长目标串的长度为两串和减去最大公共子序列。
最长目标串的数量就是所有长度相同的情况的数量加和(路径的加和)
状态f(i,j)为串str1的前i个字符...
分类:
其他好文 时间:
2014-07-28 16:23:13
阅读次数:
390
Football
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 2875
Accepted: 1462
Description
Consider a single-elimination football tournament involving 2n...
分类:
其他好文 时间:
2014-07-28 16:22:33
阅读次数:
272
A题:二分
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4791
用lower_bound可以轻松解决,不过比赛的时候逗逼了。
刚开始没有预处理,所以队友给出一组数据的时候没通过,然后一时紧张又想不出什么好的解决办法,所以就没再继续敲代码。实在有点可惜了。
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2014-07-28 16:17:53
阅读次数:
436
Description
Gigel has a strange "balance" and he wants to poise it. Actually, the device is different from any other ordinary balance.
It orders two arms of negligible weight and each arm's length...
分类:
其他好文 时间:
2014-07-28 16:14:46
阅读次数:
244
Description
Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 2...
分类:
其他好文 时间:
2014-07-28 16:09:03
阅读次数:
247
两个栈,光标前的元素一个栈,光标后的元素一个栈
sum[i]记录从1~i个元素之和,动态规划的状态方程是 dp[i] = max( dp[i-1], sum[i] ),dp[i]记录前i个元素的最大和值。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
cons...
分类:
其他好文 时间:
2014-07-28 16:07:03
阅读次数:
240
Description
Like everyone, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new geometries are the favorite.
I. M. Hei, the lead c...
分类:
其他好文 时间:
2014-07-28 15:57:14
阅读次数:
287
Problem Description
A project manager wants to determine the number of the workers needed in every month. He does know the minimal number of the workers needed in each month. When he hires or fires...
分类:
其他好文 时间:
2014-07-28 15:44:23
阅读次数:
284
http://poj.org/problem?id=1036题意:N个土匪,伸缩门的范围是K, 时间T, 伸缩门在【0, k】范围内变动,每个单位时间可以不变伸长或者缩短一个单位。给出每个最烦到达的时刻,取得的成就,和肥胖程度。即如果伸缩门的长度和土匪的肥胖程度一样,即得到成就。状态转移方程:dp[...
分类:
其他好文 时间:
2014-07-28 14:38:33
阅读次数:
256