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

## Re:大虾们帮帮忙啊！我急死了！题会做……但是不懂输入数据时什么意思……到底要输入多少个啊？该怎么写啊？（附code）

Posted by liangyunlong at 2011-04-23 23:38:24 on Problem 1458
In Reply To:大虾们帮帮忙啊！我急死了！题会做……但是不懂输入数据时什么意思……到底要输入多少个啊？该怎么写啊？（附code） Posted by:ltyxhy at 2010-05-03 19:12:48
```> #include <iostream>
> #include <cstring>
> using namespace std;
>
> int max(int a,int b)
> {
>     if(a>b)    return a;
>     else    return b;
> }
>
> int main()
> {
>     int la,lb,f[500][500];
>     char a[500],b[500];
>     cin>>a>>b;
>     la=strlen(a);
>     lb=strlen(b);
>     for(int i=1;i<=la;i++)
>         for(int j=1;j<=lb;j++)
>             f[i][j]=0;
>     for(int i=1;i<=la;i++)
>         for(int j=1;j<=lb;j++)
>         {
>             if(a[i-1]==b[j-1])    f[i][j]=f[i-1][j-1]+1;
>             else    f[i][j]=max(f[i-1][j],f[i][j-1]);
>         }
>     cout<<f[la][lb];
>     return 0;
> }
```

Followed by: