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

为什么wrong啊!求救中.....

Posted by 980616701 at 2009-04-16 18:25:59 on Problem 2159
#include<stdio.h>
int b[100],c[100];
void fun(char *s,int *w)
{
	int i=0,j=0;
	for(i=0;i<sizeof(s);i++)
		for(j=i;j<sizeof(s);j++)
		   if(s[i]==s[j])
			 w[i]++;
}
int main()
{
	int m,n,t;
	char a[100];
	scanf("%s",a);
	fun(a,b);
	for(m=0;m<sizeof(a);m++)
		for(n=m;n<sizeof(a);n++)
			if(b[n]>b[m]){t=b[n],b[n]=b[m];b[m]=t;}
	scanf("%s",a);
	fun(a,c);
    m=n=0;
	for(m=0;m<sizeof(a);m++)
		for(n=m;n<sizeof(a);n++)
			if(c[n]>c[m]){t=c[n],c[n]=c[m];c[m]=t;}
	for(m=0;m<sizeof(a);m++)
	{
		if(b[m]!=c[m]){printf("NO");return 0;}
		else {printf("YES");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