Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  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:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator