题意:
字符c1和c2的距离为d(c1, c2),已知两个字符串s和t,现在要找长度相等的两个字符串a和b,使得s是a的子序列,t是b的子序列,且a和b的距离最小。
思路:
字串和子序列是不一样的。。。。子序列是允许中间 间断 的,而字串必须是连续的...比赛的时候居然理解错了....T_T
这样的话,用最长公共子序列的思路来解决这道题就好啦~
dp[i][j]表示 “第一个串处理到...
分类:
其他好文 时间:
2015-07-13 14:04:28
阅读次数:
120
HDU5280 Senior's Array(简单DP)...
分类:
其他好文 时间:
2015-07-12 11:11:16
阅读次数:
91
//poj 2193
//sep9
#include
using namespace std;
typedef __int64 INT;
INT dp[16][2048];
int n,m;
int main()
{
int cases,t=0;
scanf("%d",&cases);
while(cases--){
scanf("%d%d",&n,&m);
memset(dp,0...
分类:
其他好文 时间:
2015-07-03 01:41:59
阅读次数:
198
转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063?viewmode=contents题目链接:http://poj.org/problem?id=1163---------------------------------------...
分类:
其他好文 时间:
2015-06-08 13:22:28
阅读次数:
110
250
Description
给你一串数字序列,每次删掉第ii个数,获得权值w[i?1]×w[i+1]w[i-1]\times w[i+1],求最后剩下第一个和最后一个数获得的最大权值和
Solution
简单dp,枚举断点即可
Code#include
using namespace std;
const int N = 55;
typedef long...
分类:
其他好文 时间:
2015-06-05 19:46:53
阅读次数:
101
Climbing StairsTotal Accepted:54579Total Submissions:158996My SubmissionsQuestionSolutionYou are climbing a stair case. It takesnsteps to reach to the...
分类:
其他好文 时间:
2015-06-05 10:08:35
阅读次数:
105
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3427可以证明最终序列为-1...0....1因为首先如果 a(i-1) 为-1或0,执行操作不会让答案变优。然后,如果可以加到大于1的某个数字,一定可以加到1,显然加到1更佳。然后简单dp,f[...
分类:
其他好文 时间:
2015-06-04 08:35:42
阅读次数:
135
DescriptionSome of Farmer John'sNcows (1 ≤N≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants t...
分类:
其他好文 时间:
2015-05-30 00:29:43
阅读次数:
321
dp[i][j]dp[i][j]表示时刻i,在车站j,等待的最少时间
有3中方案:
等一分钟
往左搭车
往右搭车/*************************************************************************
> File Name: uva1025.cpp
> Author: ALex
> Mail: zchao1...
分类:
其他好文 时间:
2015-05-25 22:34:21
阅读次数:
237
2014上海邀请赛 卡读题 教训是要培养一种”水一炮试试“的意识 实质是简单DP
分类:
其他好文 时间:
2015-05-20 20:06:05
阅读次数:
117