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

第一次提交c++wa了,然后g++ac。好吧。。。。。贴贴代码

Posted by TSERROF at 2012-10-23 14:08:06 on Problem 1458
#include <iostream>
#include <cstring>
using namespace std;
char s1[500],s2[500];
int res[500][500];
int main()
{
	while(cin>>s1>>s2)
	{
		memset(res,0,sizeof(res));
		for(int i=0;i<strlen(s1);++i)
			for(int j=0;j<strlen(s2);++j)
			{
				if(s1[i]==s2[j])res[i][j]=res[i-1][j-1]+1;
				else res[i][j]=max(res[i][j-1],res[i-1][j]);
			}
		cout<<res[strlen(s1)-1][strlen(s2)-1]<<endl;
	}
	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