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

2159还是wa 无语中 牛人帮忙看看 多谢

Posted by SuperYanyan at 2010-03-21 11:05:03 on Problem 2159
#include<stdio.h>
#include<string.h>
void main()
{
	char a[100],b[100];
	int h,i,num1=0,num2=0,length1,length2,c[100]={0},d[100]={0},temp;
	gets(a);
	gets(b);
	length1=strlen(a);
	length2=strlen(b);
	if(length1==length2)
	{
		for(h=0;h<length1;h++)
		{
			if(a[h]=='A') c[0]++;
			if(a[h]=='B') c[1]++;
			if(a[h]=='C') c[2]++;
			if(a[h]=='D') c[3]++;
			if(a[h]=='E') c[4]++;
			if(a[h]=='F') c[5]++;
			if(a[h]=='G') c[6]++;
			if(a[h]=='H') c[7]++;
			if(a[h]=='I') c[8]++;
			if(a[h]=='J') c[9]++;
			if(a[h]=='K') c[10]++;
			if(a[h]=='L') c[11]++;
			if(a[h]=='M') c[12]++;
			if(a[h]=='N') c[13]++;
			if(a[h]=='O') c[14]++;
			if(a[h]=='P') c[15]++;
			if(a[h]=='Q') c[16]++;
			if(a[h]=='R') c[17]++;
			if(a[h]=='S') c[18]++;
			if(a[h]=='T') c[19]++;
			if(a[h]=='U') c[20]++;
			if(a[h]=='V') c[21]++;
			if(a[h]=='W') c[22]++;
			if(a[h]=='X') c[23]++;
			if(a[h]=='Y') c[24]++;
			if(a[h]=='Z') c[25]++;
		}
		for(h=0;h<26;h++)
		{
			for(i=0;i<26;i++)
			{
				if(c[h]>c[i])
				{
					temp=c[i];
					c[i]=c[h];
					c[h]=temp;
				}
			}
		}
for(h=0;h<length1;h++)
		{
			if(b[h]=='A') d[0]++;
			if(b[h]=='B') d[1]++;
			if(b[h]=='C') d[2]++;
			if(b[h]=='D') d[3]++;
			if(b[h]=='E') d[4]++;
			if(b[h]=='F') d[5]++;
			if(b[h]=='G') d[6]++;
			if(b[h]=='H') d[7]++;
			if(b[h]=='I') d[8]++;
			if(b[h]=='J') d[9]++;
			if(b[h]=='K') d[10]++;
			if(b[h]=='L') d[11]++;
			if(b[h]=='M') d[12]++;
			if(b[h]=='N') d[13]++;
			if(b[h]=='O') d[14]++;
			if(b[h]=='P') d[15]++;
			if(b[h]=='Q') d[16]++;
			if(b[h]=='R') d[17]++;
			if(b[h]=='S') d[18]++;
			if(b[h]=='T') d[19]++;
			if(b[h]=='U') d[20]++;
			if(b[h]=='V') d[21]++;
			if(b[h]=='W') d[22]++;
			if(b[h]=='X') d[23]++;
			if(b[h]=='Y') d[24]++;
			if(b[h]=='Z') d[25]++;
		}
	for(h=0;h<26;h++)
		{
			for(i=0;i<26;i++)
			{
				if(d[h]>d[i])
				{
					temp=d[i];
					d[i]=d[h];
					d[h]=temp;
				}
			}
		}
	for(i=0;i<26;i++)
	{
		
		if(c[i]!=d[i]) break;

			
	}if(i==26) 
	printf("YES\n");
	else printf("NO\n");

	}
	else
		printf("NO\n");
}
	




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