本文共 1848 字,大约阅读时间需要 6 分钟。
abcfbc abfcabprogramming contest abcd mnp
420
#include#include #include using namespace std;string a,b;int c[1001][1001];int main(){ int n,m,k,i,j; while(cin>>a>>b) { memset(c,0,sizeof(c)); n=a.size(); m=b.size(); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { if(a[i-1]==b[j-1]) { c[i][j]=c[i-1][j-1]+1; } else c[i][j]=max(c[i-1][j],c[i][j-1]); } } cout< <
转载地址:http://zxfci.baihongyu.com/