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

这代码哪里错了?

Posted by zhouy869 at 2009-03-27 21:16:12
#include<stdio.h>
#include<string.h>
int main()
{   
	int m=0,n=0,i=0,j=0,k,len,h=0;
	long money[100]={0},a[100];
	char dic[100][20];
	scanf("%d%d",&m,&n);
	for(i=0;i<m;i++)
	{
		scanf("%s",&dic[i]);
		scanf("%d",&money[i]);
	}
   for(k=0;k<n;k++)  
	
	  {   char des[100][16]={" "};
		  long salary=0,z=0;
		  
          for(j=0; ;j++)
	       {
		         scanf("%s",&des[j]);
		         len=strlen(des[j]);
		       
				 if(des[j][len-1]=='.'){z=1 ;}
		    
			  for(i=0;i<m;i++)
			    {
                if(strcmp(dic[i],des[j])==0)salary+=money[i];
	 		    }
			   if(z==1)break;
		   }              
	    a[k]=salary;
	  }
	  for(k=0;k<n;k++)
	  {
		  printf("%d\n",a[k]);
	  }
	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