同样第三个点RE QWQ
by PeterAlphaLi @ 2018-07-20 21:31:58
推荐循环链表
by 66AC66 @ 2018-07-28 14:23:59
推荐直接用队列
by AFoeir @ 2018-07-28 17:50:50
代码奉上
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
using namespace std;
int main()
{
int n, i = 1, m, r;
system("color 8F");
queue<int> a;
cin >> n >> m;
for (int j = 1; j <= n; j++) {
a.push(j);
}
while (n > 0) {
while (i <= m) {
if (i == m) {
r = a.front();
cout << r << " ";
a.pop();
n--;
i++;
}
else {
r = a.front();
a.pop();
a.push(r);
i++;
}
}
i = 1;
}
return 0;
}
by AFoeir @ 2018-07-28 17:53:41
m,n<=100并不意味着m,n一定是正数,还有可能是0。
by cheng_ @ 2018-07-30 20:19:20