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

why wa??

Posted by hdjtdxacm at 2009-02-20 19:35:21 on Problem 2159
#include<stdio.h>
#include<string.h>
int s1[27]={0};
int s2[27]={0};
int main()
{
	char a[101],b[101];
	int i,j,flag,len;
	scanf("%s%s",a,b);
	len=strlen(a);
	int count1=0,count2=0;
	for(i=0;i<26;i++)
	{
		s1[i]=0;
		s2[i]=0;
	}
	for(i=0;i<len;i++)
	{
		s1[a[i]-'A']++;
		s2[b[i]-'B']++;
	}
//	int count=0;
	for(i=0;i<26;i++)
	{
		flag=0;
		for(j=0;j<26;j++)
		{
			if(s1[i]==s2[j])
			{
				flag=1;
				break;
			}
		}
		if(flag==0)
			break;
	}
	if(i==26)
		printf("YES\n");
	else
		printf("NO\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