# lucky number

2 5
1 1 2 2 3


3

#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
int n,m,i,t,j;
vector<int> v;
while(scanf("%d%d",&n,&m)!=EOF &&m &&n )
{
for(i=0;i<m;++i)
{
scanf("%d",&t);
v.push_back(t);
}
sort(v.begin(),v.end());
for( i=0,t=v[0]; i<m; )
{
j=0;
while(v[i]==t)
{
++j;
++i;
}
if(j!=n) { printf("%d\n",v[--i]); break; }
else t=v[i];
}
v.clear();
}
return 0;
}
/**************************************************************
Problem: 1380
User: 3011216016
Language: C++
Result: Memory Limit Exceed
****************************************************************/
66038730112160161380Memory
Limit Exceed4100KB728B440MSC++
/ 代码 / 编辑19:38:47
• 本文已收录于以下专栏：

## ZOJ 3233 Lucky Number（容斥原理）

Lucky Number Time Limit: 5 Seconds      Memory Limit: 32768 KB Watashi loves M mm very mu...

## hdu 4937 Lucky Number 科学暴力

Lucky Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

## Codeforces 110A-Nearly Lucky Number(实现)

A. Nearly Lucky Number time limit per test 2 seconds memory limit per test 256 megabytes...

## topcoder: TCHS10 Championship Round DIV 1 (lucky number third level)

Problem Statement   The digits 4 and 7 are lucky digits, and all other digits are unlucky...

## HDU-4937-Lucky Number

举报原因： 您举报文章：lucky number 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)