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:371b贴代码报复社会

Posted by jndx20111221395 at 2012-04-07 15:42:10 on Problem 2028
In Reply To:483B优化不动了 求大牛优化 Posted by:Sayakiss at 2010-06-26 16:37:26
#include<stdio.h>
int main()
{
	int n,q,num,d,i,j;
	while(scanf("%d%d",&n,&q),n!=0)
	{
		int a[100]={0},m=0,s=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&num);
			if(num==0)continue;
			for(j=0;j<num;j++)
			{
				scanf("%d",&d);
				a[d-1]++;
			}	
		}
		for(i=0;i<100;i++)
			if(a[i]>m)
				m=a[i],s=i+1;
		printf("%d\n",m>=q?s:0);	
	}
	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