From beae1781e262b2f16d3935e22ce000cd3d60479b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Sun, 10 Mar 2024 16:46:27 +0900 Subject: [PATCH] =?UTF-8?q?10=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 19 +++++++------ ...10\354\260\250\354\213\234 - BOJ 1406.cpp" | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 "YIM2UL2ET/\354\212\244\355\203\235/10\354\260\250\354\213\234 - BOJ 1406.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 3927de4..c5601a7 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -2,13 +2,14 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.02.12 | 그리디 | [BOJ 18310](https://www.acmicpc.net/problem/18310) | [BOJ 18310 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/3) | -| 2차시 | 2024.02.15 | 그리디 | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) | -| 3차시 | 2024.02.18 | 스택 | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) | -| 4차시 | 2024.02.21 | 덱 | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) | -| 5차시 | 2024.02.24 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) | -| 6차시 | 2024.02.27 | 정렬 | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) | -| 7차시 | 2024.03.01 | 재귀 | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) | -| 8차시 | 2024.03.04 | 재귀 | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) | -| 9차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | +| 01차시 | 2024.02.12 | 그리디 | [BOJ 18310](https://www.acmicpc.net/problem/18310) | [BOJ 18310 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/3) | +| 02차시 | 2024.02.15 | 그리디 | [BOJ 1263](https://www.acmicpc.net/problem/1263) | [BOJ 1449 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/7) | +| 03차시 | 2024.02.18 | 스택 | [BOJ 2504](https://www.acmicpc.net/problem/2504) | [BOJ 2504 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/9) | +| 04차시 | 2024.02.21 | 덱 | [BOJ 1021](https://www.acmicpc.net/problem/1021) | [BOJ 1021 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/12) | +| 05차시 | 2024.02.24 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) | +| 06차시 | 2024.02.27 | 정렬 | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) | +| 07차시 | 2024.03.01 | 재귀 | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) | +| 08차시 | 2024.03.04 | 재귀 | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) | +| 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | +| 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | --- diff --git "a/YIM2UL2ET/\354\212\244\355\203\235/10\354\260\250\354\213\234 - BOJ 1406.cpp" "b/YIM2UL2ET/\354\212\244\355\203\235/10\354\260\250\354\213\234 - BOJ 1406.cpp" new file mode 100644 index 0000000..cd6939d --- /dev/null +++ "b/YIM2UL2ET/\354\212\244\355\203\235/10\354\260\250\354\213\234 - BOJ 1406.cpp" @@ -0,0 +1,28 @@ +#include +#include + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + + int n; + char ch; + std::string str; + std::stack stk1, stk2; + + std::cin >> str >> n; + for (int i = 0; i < str.size(); i++) stk1.push(str[i]); + + for (int i = 0; i < n; i++) { + std::cin >> ch; + if (ch == 'L' && !stk1.empty()) stk2.push(stk1.top()), stk1.pop(); + else if (ch == 'D' && !stk2.empty()) stk1.push(stk2.top()), stk2.pop(); + else if (ch == 'B' && !stk1.empty()) stk1.pop(); + else if (ch == 'P') std::cin >> ch, stk1.push(ch); + } + + while(stk1.size() > 0) stk2.push(stk1.top()), stk1.pop(); + while(stk2.size() > 0) std::cout << stk2.top(), stk2.pop(); + return 0; +} \ No newline at end of file