为什么wa
查看原帖
为什么wa
658798
JZXP楼主2024/5/18 10:18
#include <bits/stdc++.h>
using namespace std;
queue <int> a;
int main()
{
	int n, m, cnt;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
	{
		a.push(i);
	}
	while(!a.empty())
	{
		if(cnt == m)
		{
			cout << a.front() << " ";
			a.pop();
			cnt = 1;
		}
		else if(cnt != m)
		{
			cnt++;
			a.push(a.front());
			a.pop();
		}
	}
	return 0;
}
2024/5/18 10:18
加载中...