Skip to content

Commit

Permalink
03/03/2020
Browse files Browse the repository at this point in the history
  • Loading branch information
witheunjin committed Mar 3, 2020
1 parent e838221 commit dccc109
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
41 changes: 41 additions & 0 deletions BaekJoon/9012_괄호.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <iostream>
#include <stack>
#include <vector>
using namespace std;

vector<string> str;

void isVps(vector<string> para) {
for (size_t i = 0; i < para.size(); ++i) {
stack<char> s;
size_t j = 0;
for (j = 0; j < para[i].size(); ++j) {
if (para[i][j]=='(') {
s.push(para[i][j]);
}
else if(para[i][j]==')'){
if (!s.empty())
{
s.pop();
}
else {
--j;
break;
}
}
}
if (j == para[i].size() && s.empty()) cout << "YES" << endl;
else cout << "NO" << endl;
}
}
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string input;
cin >> input;
str.push_back(input);
}
isVps(str);
return 0;
}
9 changes: 6 additions & 3 deletions BaekJoon/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# BaekJoon
# BaekJoon
https://www.acmicpc.net/

**맞았습니다!**
---
- **10828.스택** : 시도 1회 (2020.03.03)
- **10845.큐** : 시도 1회 (2020.03.03)
| 문제번호 | 문제이름 | 날짜 | 시도횟수|
|:-----:|:-----:|:--:|:-----:|
| **10828**|**스택** |2020.03.03|1|
| **10845**|****|2020.03.03|1|
| **9012**|**괄호** |2020.03.03|1|

0 comments on commit dccc109

Please sign in to comment.