| ||||||||||
| 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 | |||||||||
怎么总是wa,哪位高手帮我看看吧!!!!!
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator