麻烦看一下为什么是25分呀555555
查看原帖
麻烦看一下为什么是25分呀555555
414220
2019lzh楼主2022/4/13 14:32

样例通过,测试点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() ;
			}
		}
	}
}
2022/4/13 14:32
加载中...