Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <queue>
- using namespace std;
- int main() {
- queue<int> q;
- int n, m, i,j;
- cin >> n >> m;
- for (i = 1; i <= n; i++) {
- q.push(i);
- }
- printf("<");
- for (i = 0; i < n - 1; i++) {
- for (j = 0; j < m - 1; j++) {
- q.push(q.front());
- q.pop();
- }
- printf("%d, ", q.front());
- q.pop();
- }
- printf("%d>", q.front());
- return 0;
- }
Add Comment
Please, Sign In to add comment