标签:i++ space ring 16px iostream bst printf using nbsp
明天写
超时代码:
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
char a[100010],b[100010];
int Max,L1,L2;
int dp[3][100010];
int main()
{
int i,j;
while(~scanf("%s",a+1)){
scanf("%s",b+1);
L1=strlen(a+1);
L2=strlen(b+1);
for(i=1;i<=L1;i++)
for(j=1;j<=L2;j++){
if(a[i]==b[j]){
dp[i%3][j]=dp[(i+2)%3][j-1]+1;
if(dp[i%3][j]>Max) Max=dp[i%3][j];
}
else dp[i%3][j]=0;
}
printf("%d\n",Max);
}
return 0;
}
HDU1403Longest Common Substring
标签:i++ space ring 16px iostream bst printf using nbsp
原文地址:http://www.cnblogs.com/hua-dong/p/7636191.html