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

Re:why??两个有区别吗????

Posted by others_code at 2006-07-12 16:20:15 on Problem 2159
In Reply To:why??两个有区别吗???? Posted by:fjnu105042003001 at 2006-07-12 15:41:55
> #include <stdio.h>
> #include <string.h>
> int main ()
> {
> 	char s1[110];
> 	char s2[110];
> 	int l1,l2;
> 	int c1[26],c2[26];
> 	int i,j;
>     memset (c1,0,sizeof(c1));
> 	memset (c2,0,sizeof(c2));
> 	scanf ("%s",s1);
> 	scanf ("%s",s2);
> 	l1=strlen (s1);  l2=strlen (s2);
> 	if (l1!=l2)  { printf ("NO\n"); return 1; }
> 	
> 	for (i=0;i<l1;i++)  c1[s1[i]-'A']++;
> 	for (i=0;i<l2;i++)  c2[s2[i]-'A']++;
> 
> 	for (i=0;i<26;i++)
> 	{
> 		for (j=0;j<26;j++)
> 			if (c1[i]==c2[j])  break;
> 		if (j>=26)  break;
> 		c2[j]=0;
> 	}
> 	if (i<26)  printf ("NO\n");
> 	else printf ("YES\n");
> 	
> 
> 	return 1;
> }
> 
> 
> AC~~~~~~~~~~~~!!!!!!!!!!!!!!!!
> ****************************************************************
> 
> 这个wa~~~~~~~~~~~~~~~????
> #include <stdio.h>
> #include <string.h>
> 
> int main()
> {
> 	char s1[101],s2[101];
> 	int l1,l2;
> 	int i,j;
> 	int c1[26],c2[26];
> 	memset(c1,0,sizeof(c1));
> 	memset(c2,0,sizeof(c2));
> 
> 	scanf("%s",s1);
>     scanf("%s",s2);
> 	l1=strlen(s1);
> 	l2=strlen(s2);
>     if(l1!=l2)  { printf("NO\n");return 0;}
> 	for(i=0;i<l1;i++)  c1[s1[i]-'A']++;
> 	for(i=0;i<l2;i++)  c1[s2[i]-'A']++;	
                            ~~~~c2!!!! 这里不同~ 



> 	for(i=0;i<26;i++)
> 	{
> 		for(j=0;j<26;j++)
> 			if(c1[i]==c2[j])  break;
>         if(j>=26)  break;
> 		c2[j]=0;
> 	}
> 	if(i<26)  printf("NO\n");
> 	else 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