Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这段代码很简单的,就是WA,哪位大牛指点下~

Posted by iYao at 2009-07-19 13:47:33 on Problem 2159
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator