| ||||||||||
| 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 | |||||||||
16Ms#include<stdio.h>
int main()
{
int N, Q;
int a[1000];
int i, j, p;
int count, Max;
fscanf(stdin, "%d %d", &N, &Q);
while (N+Q)
{
for (i=1; i<100; i++)
a[i] = 0;
Max = 0;
for (i=0; i<N; i++)
{
fscanf(stdin, "%d", &j);
for (p=0; p<j; p++)
{
fscanf(stdin, "%d", &count);
a[count]++;
if (count > Max)
{
Max = count;
}
}
}
count = 0;
for (i=1; i<=Max; i++)
if (a[i] >= Q)
{
count = i;
Q = a[i] + 1;
}
printf("%d\n", count);
fscanf(stdin, "%d %d", &N, &Q);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator