-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e838221
commit dccc109
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |