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

CE了四次,题意很重要啊,还有就是不能按照举例来,注意清0

Posted by xuhui at 2012-01-28 21:06:20 on Problem 2159
#include<stdio.h>
#include<string.h>
int main()
{
	char a[110]={'0'},b[110]={'0'};
	int i,j;
	char t,ch;
	while(scanf("%s %s",a,b)!=EOF)
	{
		int k=0;
			int x[26]={0},y[26]={0};
	int t1=strlen(a);
	int t2=strlen(b);
	if(t1==t2)
	{
	for(i=0;i<t1;i++)
	{
	x[a[i]-'A']++;
	y[b[i]-'A']++;
	}
	for(j=0;j<25;j++)
	for(i=0;i<25-j;i++)
	{
		if(x[i]>x[i+1])
		{
	t=x[i];
	x[i]=x[i+1];
	x[i+1]=t;
		}
		if(y[i]>y[i+1])
		{
	ch=y[i];
	y[i]=y[i+1];
	y[i+1]=ch;
	}
	}
	for(i=0;i<26;i++)
	{
	if(x[i]==y[i])
	k++;
	}
	if(k==26)printf("YES\n");
	else printf("NO\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