| ||||||||||
| 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 | |||||||||
谁能帮我查下错啊?不知道是不是题意理解错了哦?谢谢!#include<stdio.h>
#include<string.h>
int main()
{
char s1[201],s2[201],s[201];
int l1,l2,i,j;
gets(s1);
gets(s2);
l1=strlen(s1);
l2=strlen(s2);
if (l1<l2)
{
i=l1;
l1=l2;
l2=i;
strcpy(s,s1);
strcpy(s1,s2);
strcpy(s2,s);
}
for (i=l1;i<l1+l2;i++)
s1[i]='0';
for (i=0;i<l1;i++)
{
for (j=0;j<l2;j++)
if (s1[i+j]=='2'&&s2[j]=='2') break;
if (j==l2)
{
if (l2+i<=l1) printf("%d\n",l1);
else printf("%d\n",i+l2);
break;
}
}
if (i==l1)
{
for (i=l2-2;i>=0;i--)
{
for (j=l2-1;i+j+1-l2>=0;j--)
if (s1[i+j+1-l2]=='2'&&s2[j]=='2') break;
if (i+j+1-l2==-1)
{
printf("%d\n",l1-i+l2-1);
break;
}
}
if (i==-1) printf("%d\n",l1+l2);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator