Skip to content

Commit

Permalink
Merge pull request #31 from AlgoLeadMe/10-YIM2UL2ET
Browse files Browse the repository at this point in the history
10-YIM2UL2ET
  • Loading branch information
YIM2UL2ET committed Mar 19, 2024
2 parents 78e6d12 + beae178 commit 75b397f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
19 changes: 10 additions & 9 deletions YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
---
28 changes: 28 additions & 0 deletions YIM2UL2ET/μŠ€νƒ/10μ°¨μ‹œ - BOJ 1406.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
#include <stack>

int main(void)
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);

int n;
char ch;
std::string str;
std::stack <char> 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;
}

0 comments on commit 75b397f

Please sign in to comment.