From 7e1f5ef5181ffbf0cb477dc17de6218d8a6fcc37 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Sat, 23 May 2026 17:37:51 +0900 Subject: [PATCH 1/2] =?UTF-8?q?3986=20:=20=EC=A2=8B=EC=9D=80=20=EB=8B=A8?= =?UTF-8?q?=EC=96=B4=20solve=20v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week1/BOJ3986/BOJ3986_V1.cpp | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/week1/BOJ3986/BOJ3986_V1.cpp diff --git a/src/week1/BOJ3986/BOJ3986_V1.cpp b/src/week1/BOJ3986/BOJ3986_V1.cpp new file mode 100644 index 0000000..b50bdb5 --- /dev/null +++ b/src/week1/BOJ3986/BOJ3986_V1.cpp @@ -0,0 +1,65 @@ +#include +using namespace std; +vector A; +vector B; +int count_A; +int count_B; +vector input_str; +int result_cnt; +void clear_input() { + count_A = 0; + count_B = 0; + A.clear(); + B.clear(); +} + +int check(const vector& vec) { + for (int j=0; j> n; + + for (int i=0; i> temp; + input_str.push_back(temp); + } + + for (int i=0; i Date: Sun, 24 May 2026 00:06:47 +0900 Subject: [PATCH 2/2] =?UTF-8?q?3986=20:=20=EC=A2=8B=EC=9D=80=20=EB=8B=A8?= =?UTF-8?q?=EC=96=B4=20solve=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week1/BOJ3986/BOJ3986_V2.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/week1/BOJ3986/BOJ3986_V2.cpp diff --git a/src/week1/BOJ3986/BOJ3986_V2.cpp b/src/week1/BOJ3986/BOJ3986_V2.cpp new file mode 100644 index 0000000..22c4e58 --- /dev/null +++ b/src/week1/BOJ3986/BOJ3986_V2.cpp @@ -0,0 +1,31 @@ +#include +using namespace std; +int n; +int cnt; + +int main() { + + cin >> n; + + for (int i = 1; i <= n; i++) { + stack stk; + string s; + cin >> s; + for (int j = 0; j < s.length(); j++) { + if (stk.size() != 0 && stk.top() == s[j]) { + stk.pop(); + } else { + stk.push(s[j]); + } + } + + if (stk.size() == 0) { + cnt++; + } + + } + + cout << cnt << "\n"; + + return 0; +}