Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
tynnp authored Jun 15, 2024
1 parent 9277c42 commit c703861
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions UPCODER/Cấu trúc dữ liệu/1. Tìm kiếm/VONGTRON02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <bits/stdc++.h>
using namespace std;

int main() {
int tmp, n, m;
queue<int> q;
queue<int> k;
cin >> n >> m;

while (m--) {
cin >> tmp;
k.push(tmp);
}

for (int i = 0; i < n; i++)
q.push(i);

while (!q.empty()) {
m = k.front();
k.push(m);
k.pop();

for (int i = 1; i < m; i++) {
q.push(q.front());
q.pop();
}

cout << q.front() << " ";
q.pop();
}

return 0;
}

0 comments on commit c703861

Please sign in to comment.