SHARE
TWEET

Untitled

a guest Jul 15th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include<queue>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9.     int N, M;
  10.     queue<int> q;
  11.  
  12.     cin >> N >> M;
  13.  
  14.     for (int i = 1; i <= N; i++) {
  15.         q.push(i);
  16.     }
  17.  
  18.     cout << '<';
  19.     for (int i = 0; i < N-1; i++) {
  20.         for (int j = 0; j < M-1; j++) {
  21.             q.push(q.front());
  22.             q.pop();
  23.         }
  24.         cout << q.front()<<", ";
  25.         q.pop();
  26.     }
  27.     cout << q.front() << '>';
  28.     return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top