You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
453 B
21 lines
453 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int n, m;
|
|
queue<int> q;
|
|
|
|
int main() {
|
|
//读入n个人,数到m的人
|
|
cin >> n >> m;
|
|
for (int i = 1; i <= n; i++) q.push(i);//放入初始化小朋友
|
|
while (!q.empty()) { //洛谷网站上的描述
|
|
for (int i = 1; i < m; i++) {
|
|
q.push(q.front());
|
|
q.pop();
|
|
}
|
|
printf("%d ", q.front());
|
|
q.pop();
|
|
}
|
|
return 0;
|
|
} |