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

为什么WA?哪位牛人可不可以弄个数据看看啊

Posted by Alexande at 2006-03-19 13:26:10 on Problem 2681
#include <stdio.h>
#include <string.h>
#define Max 100

void main()
{
   int s[26];
   int i,k,l,N,count;
   char str[Max],str1[Max];
   scanf("%d",&N);
   for(k=0;k<N;k++)
   {
     for(i=0;i<26;i++)
		 s[i]=0;
	 fflush(stdin);
	 gets(str);
	 if(strcmp(str," ")!=0)
	 for(i=0;i<strlen(str);i++)
	 {
	    l=str[i]-'a';
		s[l]++;
	 }
	 gets(str1);
	 if(strcmp(str1," ")!=0)
	 for(i=0;i<strlen(str1);i++)
	 {
	    l=str1[i]-'a';
        s[l]--;
	 }
	 count=0;
	 for(i=0;i<26;i++)
	 {
		 if(s[i]<0)
		 {  
			 s[i]=-s[i];
		 }
		 count+=s[i];
	 }
	 printf("Case #%d:  %d\n",k+1,count);
   } 

}



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