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

SOS! 谁给点BT的数据? 无尽的WA。。。

Posted by WAsign at 2007-05-17 12:55:40 on Problem 1458
RT

#include<iostream>
#include<string>
using namespace std;
int main()
{
	char a[5000],b[5000];
	int i,j,n,p,q,t,m;
	while(cin>>a>>b)
    {
		
	      p=0;t=0;m=0;
		while(b[p]!='\0')
		{
			n=0;q=0;
		for(i=p;i<strlen(b);i++)
			for(j=q;j<strlen(a);)
			{
				if(b[i]==a[j])
				{
					p++;
					j++;
					q=j;
					n++;
					break;
				}
				else j++;
			}
			t++;
			p=t;
			if(m<n)m=n;	
		}
	         cout<<m<<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