Skip to content

Commit

Permalink
Merge pull request #71 from AlgoLeadMe/17-bomik0221
Browse files Browse the repository at this point in the history
17-bomik0221
  • Loading branch information
bomik0221 authored Mar 5, 2024
2 parents bec5808 + d318a45 commit 82668dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions bomik0221/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
| 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) |
---

18 changes: 18 additions & 0 deletions bomik0221/μŠ€νƒ/240227.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
#include <stack>

int main() {
std::string S;
std::cin >> S;
std::stack<int>stack;

for (int num = 0; num < S.size(); num++) {
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;
}

0 comments on commit 82668dc

Please sign in to comment.