Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 又是TLE?????请问出错之处？？又是TLE?????请问出错之处？？又是TLE?????请问出错之处？？又是TLE?????请问出错之处？？

Posted by win1611 at 2010-03-16 18:04:49 on Problem 1458
```/*********************************************

*********************************************/
#include<iostream>
#include<string>
using namespace std;

int L[500][500];

int main()
{
char aa[500],bb[500];
int i,j;

while(1){
memset(aa,0,sizeof(aa));
memset(bb,0,sizeof(bb));
memset(L,0,sizeof(L));

scanf("%s%s",aa,bb);
int l1 = strlen(aa);
int l2 = strlen(bb);

for(i = 0 ;i <= l1;i ++)
L[i][0] = 0;
for(j = 0 ;j <= l2;j ++)
L[0][j] = 0;
for(i = 0;i < l1;i ++)
for(j = 0;j < l2;j ++){
if(aa[i]==bb[j])
L[i+1][j+1] = L[i][j]+1;
else
L[i+1][j+1] = (L[i][j+1] > L[i+1][j] ? L[i][j+1] : L[i+1][j]);
}
printf("%d\n",L[l1][l2]);
}
return 0;
}```

Followed by: