Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:371b贴代码报复社会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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator