| ||||||||||
| 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 | |||||||||
Re:这段代码很简单的,就是WA,哪位大牛指点下~In Reply To:这段代码很简单的,就是WA,哪位大牛指点下~ Posted by:iYao at 2009-07-19 13:47:33 #include <stdio.h>
#include <string.h>
int main ()
{
int i, j;
char a[101], b[101];
scanf ("%s%s", a, b);
if (strlen(a) != strlen(b))
printf ("NO\n");
for (i = 0; a[i]!='\0'; i++)
{
if (a[i] == 'a')
a[i] = 'z';
else
a[i] = a[i]-1;
}
for (i = 0; a[i]!='\0'; i++)
for (j = 0; b[j]!='\0'; j++)
{
if (a[i] == b[j])
{
b[j] = 1;
break;
}
else if (b[j+1] == '\0')
{
printf ("NO\n");
return 0;
}
}
if (a[i] == '\0')
printf ("YES\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator