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:次大值不见的是max-1

Posted by nan212 at 2007-08-23 09:01:09 on Problem 2092
In Reply To:好像很简单啊 没疑问啊 怎么wa呢? Posted by:huzuosheng at 2007-07-31 01:48:07
> #include <stdio.h>
> #include <string.h>
> 
> int flag[10001];
> 
> int main()
> {
> 	int n,m,max;
> 	int i,j,x;
> 	while(scanf("%d%d",&n,&m)!=EOF&&n)
> 	{
> 		memset(flag,0,sizeof(flag));
> 		max=0;
> 		for(i=0;i<n;i++)
> 			for(j=0;j<m;j++)
> 			{
> 				scanf("%d",&x);
> 				flag[x]++;
> 				if(max<flag[x])    max=flag[x];
> 			}
> 		for(i=1;i<10001;i++)
> 			if(flag[i]==max-1)
> 				printf("%d ",i);
> 		printf("\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