- chenxueze's blog
1109:开关灯
- 2024-12-19 18:05:06 @
#include<bits/stdc++.h>
using namespace std;
int main() {
bool a[5005] = {};
int n,m;
cin >> n >> m;
for (int i = 2 ;i <= m; ++i) {
for (int j = 1;j <= n; ++j) {
if (j % i == 0) {
if (a[j]){
a[j] = false;
}else {
a[j] = true;
}
}
}
}
bool t = true;
for (int i = 1; i <= n; i++) {
if (a[i] == false){
if (t) {
t = false;
}
else {
cout << ",";
}
cout << i;
}
}
return 0;
}