#include <iostream>
#include <string.h>
using namespace std;
//开灯问题,数组问题
//输入灯的总数,人数
#define maxn 101
int main()
{
int n,k,first=1;
cin>>n>>k;
int a[maxn];
memset(a,0,sizeof(a));//这个是C语言中的,作用是把数组进行清零处理
for(int i=0;i<k;i++)
{
for(int j=0;j<n;j++)
{
if(j%i==0)
{
a[j]=!a[j];
}
}
}
for(int h=0;h<n;h++)
{
if(a[h])
{
if(first)//为什么这里面要这样写呢?
first=0;
else
{
cout<<" "<<h;
}
}
cout<<endl;
}
return 0;
}
<img src="https://img-blog.youkuaiyun.com/20160530155552273" alt="" />//出现了这个问题,是哪里错了