编译失败是为什么呀???dev上正常编译的
查看原帖
编译失败是为什么呀???dev上正常编译的
382681
Syameimaru_楼主2024/3/25 19:32
#include<bits/stdc++.h>
#include<queue>
using namespace std;

queue<int> q;
bool hashh[1005];
int m, n, num;
int cnt = 0;

int main(){
	cin>>m;
	cin>>n;
	for(int i = 0; i < n; i++){
		cin>>num;
		if(hashh[num])	continue;
		else{
			cnt++;
			hashh[num] = true;
			if(q.size() == m){
				int outt = q.front();
				hashh[outt] = false;
				q.pop();
				q.push(num); 
			}
			else{
				q.push(num);
			}
		}	
	}
	
	cout << cnt;
	
	return 0;
}
2024/3/25 19:32
加载中...