| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这个和1080差不多#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int dp[100][100];
int main()
{
string s1,s2;
while(cin>>s1>>s2)
{
memset(dp,0,sizeof(dp));
for(int i=0;i<s1.size();++i)
for(int j=0;j<s2.size();++j)
{
if(s1[i]==s2[j])dp[i+1][j+1]=dp[i][j]+1;
else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
}
cout<<dp[s1.size()][s2.size()]<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator