第二题则么改称第三题 跪求
查看原帖
第二题则么改称第三题 跪求
1285256
mihoyou楼主2024/3/10 16:12
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,m;
   cin>>n>>m;
   queue<int> q;
   for(int i=1;i<=n;i++)
   		q.push(i);
   while(q.size())
   {
       for(int i=1;i<=m-1;i++)
       {
       	   int x=q.front();
           q.pop();
           q.push(x);	
	   }
	   int x=q.front();
	   q.pop();
	   cout<<x<<" ";
   }
    return 0;
}

2024/3/10 16:12
加载中...