From dccc109d4efeefdb3946bed898f47a02f829f188 Mon Sep 17 00:00:00 2001 From: EunJin Lee <50702052+witheunjin@users.noreply.github.com> Date: Tue, 3 Mar 2020 23:33:59 +0900 Subject: [PATCH] 03/03/2020 --- "BaekJoon/9012_\352\264\204\355\230\270.cpp" | 41 ++++++++++++++++++++ BaekJoon/README.md | 9 +++-- 2 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 "BaekJoon/9012_\352\264\204\355\230\270.cpp" diff --git "a/BaekJoon/9012_\352\264\204\355\230\270.cpp" "b/BaekJoon/9012_\352\264\204\355\230\270.cpp" new file mode 100644 index 0000000..461d515 --- /dev/null +++ "b/BaekJoon/9012_\352\264\204\355\230\270.cpp" @@ -0,0 +1,41 @@ +#include +#include +#include +using namespace std; + +vector str; + +void isVps(vector para) { + for (size_t i = 0; i < para.size(); ++i) { + stack 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; +} \ No newline at end of file diff --git a/BaekJoon/README.md b/BaekJoon/README.md index da76e01..57d6985 100644 --- a/BaekJoon/README.md +++ b/BaekJoon/README.md @@ -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| \ No newline at end of file