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 <stdio.h> #include <string.h> int main() { int i, j; char a[100], b[100]; scanf ("%s%s", a, b); if (strlen(a) != strlen(b)) { printf ("NO\n"); return 0; } //printf ("%s\n%s\n", a, b); for (i = 0; a[i]!='\0'; i++) { a[i] = a[i]-1; } //printf ("%s\n%s\n", a, b); for (i = 0; a[i]!='\0'; i++) for (j = 0; b[j]!='\0'; j++) { if (b[j] == a[i]) { b[j] = 1; break; } else if(b[j+1]=='\0') { printf ("NO\n"); return 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