上一页 1 ··· 5 6 7 8 9 10 下一页
1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXN 50 8 #define inf 65553566 9 int love[MAXN][MAXN]; /// 记录每个妹子和每个男生的好感度 10 int ex_girl[MAXN]; ... Read More
posted @ 2016-05-04 18:37 xiaotian_小天 Views(190) Comments(0) Diggs(0) Edit
KM算法详解+模板 - wenr - 博客园 http://www.cnblogs.com/wenruo/p/5264235.html Read More
posted @ 2016-05-04 17:16 xiaotian_小天 Views(142) Comments(0) Diggs(0) Edit
写的很好的一篇博客,可以看看哦! http://blog.csdn.net/dark_scope/article/details/8880547 poj 2239 1 #include<iostream> 2 #include<stdio.h> 3 #include<math.h> 4 #inclu Read More
posted @ 2016-05-02 17:11 xiaotian_小天 Views(171) Comments(0) Diggs(0) Edit
在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。 母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一 Read More
posted @ 2016-04-26 20:53 xiaotian_小天 Views(248) Comments(0) Diggs(0) Edit
#include #include #include #include using namespace std; int sum; char str1[1005]; char str2[1005]; int dp[1005][1005]; int len1,len2; int LCS(int len1,int len2) { int i,j; for(i=0;i<=len1;... Read More
posted @ 2016-03-24 15:37 xiaotian_小天 Views(118) Comments(0) Diggs(0) Edit
1 #include 2 #include 3 #include 4 using namespace std; 5 #define mod 10007 6 7 char str[1005]; 8 int dp[1005][1005]; 9 10 int main()11 {12 int ... Read More
posted @ 2015-12-20 13:39 xiaotian_小天 Views(91) Comments(0) Diggs(0) Edit
两种算法1. O(n^2) 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int a[1005]; 7 int dp[1005]; 8 int main() 9 {10 int n, maxn;11 whil... Read More
posted @ 2015-12-20 12:02 xiaotian_小天 Views(127) Comments(0) Diggs(0) Edit
注:摘的老师写的最大m子段和问题以-1 4 -2 3 -2 3为例最大子段和是:6最大2子段和是:4+(3-2+3)=8所以,最大子段和和最大m子段和不一样,不能用比如先求一个最大子段和,从序列中去掉已求子段,再求下一个最大子段和的方法,这种方法有点贪心的味道,但是不行。所以,还得用动态规划。1.基... Read More
posted @ 2015-12-13 12:04 xiaotian_小天 Views(198) Comments(0) Diggs(0) Edit
最长公共上升子序列(LCIS)的O(n^2)算法预备知识:动态规划的基本思想,LCS,LIS。问题:字符串a,字符串b,求a和b的LCIS(最长公共上升子序列)。首先我们可以看到,这个问题具有相当多的重叠子问题。于是我们想到用DP搞。DP的首要任务是什么?定义状态。1定义状态F[i][j]表示以a串... Read More
posted @ 2015-12-13 11:57 xiaotian_小天 Views(334) Comments(0) Diggs(0) Edit
posted @ 2015-12-12 19:38 xiaotian_小天 Views(141) Comments(0) Diggs(0) Edit
上一页 1 ··· 5 6 7 8 9 10 下一页