摘要:
状态转移方程如下:res[i][j]=max{res[i-1][j-1]+f(str1[i],str2[j]),res[i-1][j]+f(str1[i],’-‘),res[i][j-1]+f(‘-‘,str2[j])};#include<iostream>#include<cstdio>#include<cstring>using namespace std;char str1[101],str2[101];int d[5][5]={ {5,-1,-2,-1,-3}, {-1,5,-3,-2,-4}, {-2,-3,5,-2,-2}, {-1,-2,-2, 阅读全文