6

蒙自市凤凰小学又阝十尃亻二 · 发布于 2023-04-25 · 浏览 604 回复 0

include <bits/stdc++.h>

using namespace std; bool light[10006];

int main() {

int n, m, ans, x = 1;
cin >> n >> m;
for (int i = 1; i <= m; i++) {
	for (int j = 1; j * i <= n; j++) {
		if (light[j * i]) {
			light[j * i] = 0;
		} else {
			light[j * i] = 1;
		}
	}
}
for (int i = 1; i <= n; i++) {
	if (light[i]){
		x=0;
		cout << i << " ";
	}
}
if(x){
	cout<<"NULL";
}
return 0;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复