到底哪里的问题?
查看原帖
到底哪里的问题?
1020330
5ooii7楼主2023/9/9 17:55
#include<bits/stdc++.h>
using namespace std;

int n,m;
queue <int> q;

int main(){
	
	cin>>n>>m;
	
	for(int i=1;i<=m-1;i++){
		q.push(i);
	}
	
	while(!q.empty()){
		for(int i=1;i<=m-1;++i){
			q.push(q.front());
			q.pop();
//			int x=q.front();
//			q.pop();
//			q.push(x);
		}
		
		if(q.front()==m){
			cout<<q.front()<<" ";
			q.pop();
		}
		
		}
		
	return 0;
}
2023/9/9 17:55
加载中...