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:抛砖引玉~~~各位高手帮我这个小水牛看看

Posted by yao503 at 2009-09-19 09:29:06 on Problem 2643
In Reply To:抛砖引玉~~~各位高手帮我这个小水牛看看 Posted by:laofuzi123 at 2009-07-15 20:01:26
> /*2643*/
> #include <stdio.h>
> #include <string.h>
> char s2[10000][82];
> void main()
> {
>   int i,j,n,m,count[22],max,min,x,y;
>   char s[21][82],s1[21][82];
>   scanf("%d",&n);
>   max=0;
>   min=100000;
>   memset(count,0,sizeof(count));
>   getchar();
>   for(i=0;i<n;i++)
>    {
> 	  gets(s[i]);
> 	  gets(s1[i]);
>    }
>   scanf("%d\n",&m);
>   for(i=0;i<m;i++)
>    {
>       gets(s2[i]);
>    }
>   for(i=0;i<n;i++)
>    {
> 	 for(j=0;j<m;j++)
> 	  {
> 	   if(strcmp(s[i],s2[j])==0)
> 		  {
> 		      count[i]++;
>     	  }
>    	 } 
>     if(count[i]>max)
> 	   {
> 		  max=count[i];
> 		  x=i;
> 	   }
>     if(count[i]<min)
> 	   {
> 		   min=count[i];
> 		   y=i;
> 	   }   
>    }
> 	  if(max==min)
> 	   {
> 	      printf("tie\n");
> 	   }
> 	  else
> 	   {
> 	       puts(s1[x]);
> 	   } 
> }

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