Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement