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

怎么总是wa,哪位高手帮我看看吧!!!!!

Posted by ahxun2006 at 2007-09-05 11:40:00 on Problem 1458
 

#include<iostream>
using namespace std;

int function(char *str1,char *str2)
{
	int sum=0,sum1=0;
	char *a,*b,*c,*d;
    a=c=str1;
    d=str2;
	while(*a!='\0')
	{
	     while(*c!='\0')
	     {
			 b=d;
			while(*d!='\0')
			{
				if(*c==*d)
				{
					sum++;
					b=(++d);
					c++;

				}
				else
				{
					d++;
				}
			}
			d=b;
			c++;
	     }
		 if(sum1<sum)
		 {
			 sum1=sum;
		 }
		 sum=0;
	     a++;
	}
	return sum1;
}
		


int main()

{
	char a[100],b[100];
	cin>>a;
	cin>>b;
	cout<<function(a,b)<<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