From c7038617dab328e7676301fa5173ee50f1e70caf Mon Sep 17 00:00:00 2001 From: tynnp <148174474+tynnp@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:14:06 +0700 Subject: [PATCH] --- .../VONGTRON02.cpp" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "UPCODER/C\341\272\245u tr\303\272c d\341\273\257 li\341\273\207u/1. T\303\254m ki\341\272\277m/VONGTRON02.cpp" diff --git "a/UPCODER/C\341\272\245u tr\303\272c d\341\273\257 li\341\273\207u/1. T\303\254m ki\341\272\277m/VONGTRON02.cpp" "b/UPCODER/C\341\272\245u tr\303\272c d\341\273\257 li\341\273\207u/1. T\303\254m ki\341\272\277m/VONGTRON02.cpp" new file mode 100644 index 00000000..f1cc2eb5 --- /dev/null +++ "b/UPCODER/C\341\272\245u tr\303\272c d\341\273\257 li\341\273\207u/1. T\303\254m ki\341\272\277m/VONGTRON02.cpp" @@ -0,0 +1,33 @@ +#include +using namespace std; + +int main() { + int tmp, n, m; + queue q; + queue 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; +} \ No newline at end of file