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

为什么会过不了呢?所有的数据都对呀。(附带code)

Posted by RUNSLOWLY at 2008-09-27 14:30:16 on Problem 1458
#include<iostream>
using namespace std;
#define MAX 1000
int main()
{
	int i,j,num=0,mid,k,he=0;
	char a[MAX],b[MAX];
	while(cin>>a>>b)
	{	
		he=0;
		for(k=0;a[k]!='\0';k++)
		{	
			j=0;
			num=0;
		for(i=k;a[i]!='\0';i++)
		{
			while(b[j]!='\0')
			{
				if(a[i]==b[j])
				{
					num++;
					j++;
					mid=j;
					break;
				}
				else
					j++;
			}
			if(num==0)
		    	j=0;
			else
				j=mid;
		}
		if(he<num)
			he=num;
		}
		cout<<he<<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