You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
433 B

#include <bits/stdc++.h>
using namespace std;
#define maxn 1010
int a[maxn];
int main() {
int n, k, first = 1;
//初始化数组
memset(a, 0, sizeof(a));
//用户输入
scanf("%d%d", &n, &k);
for (int i = 1; i <= k; i++)
for (int j = 1; j <= n; j++)
if (j % i == 0) a[j] = !a[j];
for (int i = 1; i <= n; i++)
if (a[i]) {
if (first) first = 0; else printf(" ");
printf("%d", i);
}
printf("\n");
return 0;
}