| ||||||||||
| 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 | |||||||||
为什么会过不了呢?所有的数据都对呀。(附带code)#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator