样例过,提交错,帮我必关!
查看原帖
样例过,提交错,帮我必关!
1445328
sunqikai0805楼主2025/1/24 19:21

初次使用vector,样例过了,提交后一个WA\color{red} {WA} 必关\color{gold} {必关}

#include<bits/stdc++.h>

using namespace std;

int n,m,size = 1000,x;
vector<bool> a(size);

int read(){
	int x = 0, w = 1;
	char ch = 0;
	while (ch < '0' or ch > '9'){
		if (ch == '-') w = -1;
		ch = getchar(); 
	}
	while (ch >= '0' and ch <= '9'){
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return x * w;
}

int main(){
	cin.tie(0)->sync_with_stdio(0);
	n = read(),m = read();
	for(int i = 1;i <= m;++i){
		x = read();
		a[x] = true;
	}
	for(int i = 0;i<n;i++){
		if(not a[i]) cout<<i<<' ';
	}
	return 0;
}
/*

*/

Orz

2025/1/24 19:21
加载中...