围圈报数

#include <bits/stdc++.h>
using namespace std;
int main(){
	int m,n,b=0;
	cin>>n>>m;
	queue<int> a;
	for(int i=1;i<=n;i++){
		a.push(i);
	}
	while(!a.empty()){
		b++;
		if(b%m!=0){
			a.push(a.front());
		}else{
			cout<<a.front()<<" ";
		}
		a.pop();
	}
	return 0;
}

  

posted @ 2024-01-31 11:41  fushuxuan1  阅读(7)  评论(0)    收藏  举报