From 7831706a3cb88d88c82cf37132a3919ae1f8e682 Mon Sep 17 00:00:00 2001 From: bomik0221 Date: Wed, 28 Feb 2024 01:44:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?240227=20=EA=B4=84=ED=98=B8=20=EB=81=BC?= =?UTF-8?q?=EC=9B=8C=EB=84=A3=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\354\212\244\355\203\235/240227.cpp" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "bomik0221/\354\212\244\355\203\235/240227.cpp" diff --git "a/bomik0221/\354\212\244\355\203\235/240227.cpp" "b/bomik0221/\354\212\244\355\203\235/240227.cpp" new file mode 100644 index 0000000..9250367 --- /dev/null +++ "b/bomik0221/\354\212\244\355\203\235/240227.cpp" @@ -0,0 +1,19 @@ +#include +#include + +int main() { + std::string S; + std::cin >> S; + std::stackstack; + + for (int num = 0; num < S.size(); num++) { + //if (num !=0 && S[num - 1] == '(' && S[num] == ')') stack.pop(); + if (!stack.empty() && stack.top() == 1 && S[num] == ')') stack.pop(); + else { + if (S[num] == '(') stack.push(1); + else stack.push(2); + } + } + std::cout << stack.size(); + return 0; +} From 8084e30458f4cf4398ba878663f48a6b1b1d0bce Mon Sep 17 00:00:00 2001 From: bomik0221 Date: Wed, 28 Feb 2024 19:51:02 +0900 Subject: [PATCH 2/3] Update 240227.cpp --- "bomik0221/\354\212\244\355\203\235/240227.cpp" | 1 - 1 file changed, 1 deletion(-) diff --git "a/bomik0221/\354\212\244\355\203\235/240227.cpp" "b/bomik0221/\354\212\244\355\203\235/240227.cpp" index 9250367..1631bde 100644 --- "a/bomik0221/\354\212\244\355\203\235/240227.cpp" +++ "b/bomik0221/\354\212\244\355\203\235/240227.cpp" @@ -7,7 +7,6 @@ int main() { std::stackstack; for (int num = 0; num < S.size(); num++) { - //if (num !=0 && S[num - 1] == '(' && S[num] == ')') stack.pop(); if (!stack.empty() && stack.top() == 1 && S[num] == ')') stack.pop(); else { if (S[num] == '(') stack.push(1); From 7010941a411bfee105608f8ff982d0cd6a99f6d1 Mon Sep 17 00:00:00 2001 From: bomik0221 Date: Fri, 1 Mar 2024 23:03:18 +0900 Subject: [PATCH 3/3] Update README.md --- bomik0221/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bomik0221/README.md b/bomik0221/README.md index 9c2f47b..df8cdda 100644 --- a/bomik0221/README.md +++ b/bomik0221/README.md @@ -17,5 +17,7 @@ | 13차시 | 2024.02.06 | DFS | [유기농 배추](https://www.acmicpc.net/problem/1012) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/51) | | 14차시 | 2024.02.15 | 위상정렬 | [줄 세우기](https://www.acmicpc.net/problem/2252) | [#57](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/57) | | 15차시 | 2024.02.18 | 위상정렬 | [문제집](https://www.acmicpc.net/problem/1766) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/60) | +| 16차시 | 2024.02.24 | DP | [돌 게임](https://www.acmicpc.net/problem/9655) | [#67](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/67) | +| 17차시 | 2024.02.27 | 스택 | [괄호 끼워넣기](https://www.acmicpc.net/problem/11899) | [#71](https://github.com/AlgoLeadMe/AlgoLeadMe-5/pull/71) | ---