|
- #include <cstdio>
- #include <cstdlib>
- #include <string>
- #include <cstring>
- #include <cmath>
- #include <algorithm>
- #include <iostream>
- using namespace std;
- int n,m,cun[200]={0},book[1100]={0},next1=0,all=0;
- int main()
- {
- scanf("%d%d",&n,&m);
- if(n==0)
- {
- printf("%d",m);
- return 0;
- }
- memset(cun,-1,sizeof(cun));
- for(int i=1;i<=m;i++)
- {
- int t;
- scanf("%d",&t);
- if(!book[t])
- {
- if(cun[next1]!=-1)
- book[cun[next1]]=0;
- cun[next1]=t;
- book[t]=1;
- next1=(next1+1)%n;
- all++;
- }
- }
- printf("%d",all);
- return 0;
- }
复制代码 |
|