样例通过,测试点1通过,测试点234没通过
#include<bits/stdc++.h>
using namespace std;
queue <int> xb;
int m,n,jishu=1;
int main() {
cin>>m>>n;
for(int i=1; i<=m; i++) {
if(jishu==n) {
jishu=1;
cout<<i<<" ";
m--;
} else xb.push(i);
}
while(1) {
for(int i=1; i<=m; i++) {
if(xb.empty()) return 0;
if(jishu==n) {
jishu=1;
cout<<xb.front()<<" ";
xb.pop() ;
m--;
} else {
xb.push(xb.front() );
xb.pop() ;
jishu++;
}
while(m<n&&!xb.empty() ){
cout<<xb.front() <<" ";
xb.pop() ;
}
}
}
}