做好事,不留名
wuhongzhen
2020-11-21 9:42:18
2022-04-03 14:50:32
15
返回题目
#include<bits/stdc++.h>
using namespace std;
int q[1000000];
int head,tail;
void push(int x)
{
q[++tail]=x;
}
int front(){
return q[head+1];
}
void pop(){
head++;
}
int size(){
return tail-head;
}
bool empty()
{
return head==tail;
}
int main()
{
int n,m,t=1;
cin>>n>>m;
int j=m;
for(int i=1;i<=n;i++)
{
push(i);
}
while(!empty()){
int x=front();
pop();
if(t%m!=0){
push(x);
}
else
cout<<x<<" ";
t++;
}
return 0;
}
{{ vote && vote.total.up }}