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.

22 lines
401 B

#include<bits/stdc++.h>
using namespace std;
#define MAX 1000+10
int a[MAX];
int main()
{
int i, j, n, k;
memset(a, 0, sizeof(a));
scanf("%d%d", &n, &k);
for(i = 1; i <= k; i++)
for(j = 1; j <= n; j++)
if(j%i == 0) a[j] = !a[j];
for(i = 1; i <= n; i++) if(a[i])
{
if(i == n) printf("%d\n", i);
else printf("%d ", i);
}
return 0;
}