Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <cstdio>
  2. #include <queue>
  3. using namespace std;
  4.  
  5.  
  6. int main(void)
  7. {
  8. int n, m;
  9. scanf("%d %d", &n, &m);
  10.  
  11. queue<int> q;
  12.  
  13. for(int i = 1;i<=n;i++) q.push(i);
  14.  
  15. printf("<");
  16. while(!q.empty()) {
  17. for (int i = 0; i < m - 1; i++) {
  18. q.push(q.front());
  19. q.pop();
  20. }
  21. if(q.size() != 1) printf("%d, ", q.front());
  22. else printf("%d>", q.front());
  23. q.pop();
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement