为什么这样就不对呢。。。(数组模拟队列)

#include<iostream>
#include<cstdio>
using namespace std;

int judge[1000+5]={0};
int M[1000+5]={0};
int ans=0;
int n,m;

int main()
{
scanf("%d%d",&m,&n);
int temp;
for(int i=0;i<n;i++)
{
scanf("%d",&temp);
if(judge[temp]==0)
{
judge[temp]=1;
if(i>=m)
judge[M[i%m]]=0;
M[i%m]=temp;
ans++;
}
}

printf("%d",ans);

//while(1);
return 0;

}

0 条评论

目前还没有评论...

信息

ID
1774
难度
4
分类
模拟 点击显示
标签
递交数
3063
已通过
1230
通过率
40%
被复制
10
上传者