//////////////////////////////////////////////////////////////////
//鸽巢原理做
#include<iostream>
using namespace std;
int buc[10001],peo[20001];

 


int main()
{
    int i,n,m,count;
    while(cin>>n>>m && !(n==0&&m==0))
    {
        count=0;
        for(i=0;i<n+1;i++)
            buc[i]=0;
        for(i=1;i<=m;i++)
        {
            cin>>peo[i];
            if(buc[peo[i]]==1)
                count++;
            buc[peo[i]]++;
        }
        cout<<count<<endl;
    }
    return 0;
}

相关文章:

  • 2021-12-18
  • 2021-09-08
  • 2022-12-23
  • 2021-07-06
  • 2021-05-28
  • 2022-01-05
  • 2021-07-31
猜你喜欢
  • 2022-03-08
  • 2022-12-23
  • 2021-12-06
  • 2021-09-12
  • 2021-10-25
  • 2021-09-24
相关资源
相似解决方案