From 5d67668853c523bb76202a7aa6e731724fae1fb2 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Wed, 8 May 2024 02:00:32 +0900 Subject: [PATCH 1/2] 2024-05-08 queuestack --- oesnuj/README.md | 1 + "oesnuj/\353\215\261/24511.cpp" | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 "oesnuj/\353\215\261/24511.cpp" diff --git a/oesnuj/README.md b/oesnuj/README.md index 5e5ddb8..0c1da06 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -8,4 +8,5 @@ | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | +| 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | --- diff --git "a/oesnuj/\353\215\261/24511.cpp" "b/oesnuj/\353\215\261/24511.cpp" new file mode 100644 index 0000000..1868b93 --- /dev/null +++ "b/oesnuj/\353\215\261/24511.cpp" @@ -0,0 +1,35 @@ +#include +#include +#include +using namespace std; + +int main() +{ + ios::sync_with_stdio(false); cin.tie(NULL); + int n; + cin >> n; + vector dataStructure(n); //스텍인지 큐인지 입력받기 + for (auto& i : dataStructure){ + cin >> i; + } + + deque queuestack; + for (int i = 0; i < n; i++) + { + int x; + cin >> x; + if (dataStructure.at(i) == 0) //큐인 경우에만 처리, 스택은 무조건 입력값이 나오기에 없다고 보면됨 + queuestack.push_back(x); + } + int m; + cin >> m; + for (int i = 0; i < m; i++) + { + int x; + cin >> x; + queuestack.push_front(x); + cout << queuestack.back() << " "; + queuestack.pop_back(); + } + return 0; +} From c84a9f85977abd3a924cbbc99eef63b9f9ca1cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A4=80=EC=84=9C=20Junseo=20Kim?= Date: Mon, 13 May 2024 02:47:16 +0900 Subject: [PATCH 2/2] Update README.md --- oesnuj/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oesnuj/README.md b/oesnuj/README.md index 0c1da06..d7f8d25 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -8,5 +8,5 @@ | 4차시 | 2024.04.06 | 스택 | [옥상 정원 꾸미기](https://www.acmicpc.net/problem/6198) | [#14](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/14) | | 5차시 | 2024.04.13 | 이분탐색 | [듣보잡](https://www.acmicpc.net/problem/1764) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/20) | | 6차시 | 2024.05.06 | 기하학 | [정사각형](https://www.acmicpc.net/problem/1485) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/22) | -| 7차시 | 2024.05.08 | 스택, 큐, 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | +| 7차시 | 2024.05.08 | 덱 | [queuestack](https://www.acmicpc.net/problem/24511) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/24) | ---