6

蒙自市凤凰小学又阝十尃亻二  •  1年前


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;

}


评论:

请先登录,才能进行评论