Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <queue>
- using namespace std;
- int main(void)
- {
- int n, m;
- scanf("%d %d", &n, &m);
- queue<int> q;
- for(int i = 1;i<=n;i++) q.push(i);
- printf("<");
- while(!q.empty()) {
- for (int i = 0; i < m - 1; i++) {
- q.push(q.front());
- q.pop();
- }
- if(q.size() != 1) printf("%d, ", q.front());
- else printf("%d>", q.front());
- q.pop();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement