From 3131c76169f6f510b200abbc76ccd2f53bc2049c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:36:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?11=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 1 + ...11\354\260\250\354\213\234 - BOJ 1918.cpp" | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 "YIM2UL2ET/\354\212\244\355\203\235/11\354\260\250\354\213\234 - BOJ 1918.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index c5601a7..170c23b 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -12,4 +12,5 @@ | 08차시 | 2024.03.04 | 재귀 | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) | | 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | +| 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | --- diff --git "a/YIM2UL2ET/\354\212\244\355\203\235/11\354\260\250\354\213\234 - BOJ 1918.cpp" "b/YIM2UL2ET/\354\212\244\355\203\235/11\354\260\250\354\213\234 - BOJ 1918.cpp" new file mode 100644 index 0000000..0437fb6 --- /dev/null +++ "b/YIM2UL2ET/\354\212\244\355\203\235/11\354\260\250\354\213\234 - BOJ 1918.cpp" @@ -0,0 +1,43 @@ +#include +#include + +int main(void) +{ + char ch; + std::stack stk; + std::string res; + + ch = getchar(); + while (ch != '\n') { + if (ch == '+' || ch == '-') { + while(!stk.empty() && stk.top() != '(') { + res.push_back(stk.top()); + stk.pop(); + } + stk.push(ch); + } + else if (ch == '*' || ch == '/') { + if (!stk.empty() && (stk.top() == '*' || stk.top() == '/')) { + res.push_back(stk.top()); + stk.pop(); + } + stk.push(ch); + } + else if (ch == ')') { + while (!stk.empty() && stk.top() != '(') { + res.push_back(stk.top()); + stk.pop(); + } + if (!stk.empty()) stk.pop(); + } + else if (ch == '(') stk.push(ch); + else res.push_back(ch); + ch = getchar(); + } + while (!stk.empty()) { + res.push_back(stk.top()); + stk.pop(); + } + std::cout << res; + return 0; +} \ No newline at end of file From 3a9d7c8a1b4b5fc058260d2be3b1b642db9f13b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=84=EC=8A=B9=ED=98=B8?= <132066506+YIM2UL2ET@users.noreply.github.com> Date: Thu, 28 Mar 2024 17:01:34 +0900 Subject: [PATCH 2/4] =?UTF-8?q?12=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 1 + ...2\354\260\250\354\213\234 - BOJ 11723.cpp" | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 "YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 170c23b..32219bb 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -13,4 +13,5 @@ | 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | +| 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | --- diff --git "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" new file mode 100644 index 0000000..c7b96fd --- /dev/null +++ "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" @@ -0,0 +1,36 @@ +#include + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, bits = 0; + std::string command; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> command; + if (command == "add") { + std::cin >> k; + bits |= (1<> k; + bits &= ~(1<> k; + if (bits & (1<> k; + bits ^= (1< Date: Thu, 28 Mar 2024 17:02:39 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Revert=20"12=EC=B0=A8=EC=8B=9C=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 3a9d7c8a1b4b5fc058260d2be3b1b642db9f13b6. --- YIM2UL2ET/README.md | 1 - ...2\354\260\250\354\213\234 - BOJ 11723.cpp" | 36 ------------------- 2 files changed, 37 deletions(-) delete mode 100644 "YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 32219bb..170c23b 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -13,5 +13,4 @@ | 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | -| 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | --- diff --git "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" deleted file mode 100644 index c7b96fd..0000000 --- "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" +++ /dev/null @@ -1,36 +0,0 @@ -#include - -int main(void) -{ - std::ios_base::sync_with_stdio(false); - std::cin.tie(NULL); - std::cout.tie(NULL); - - int n, k, bits = 0; - std::string command; - - std::cin >> n; - for (int i = 0; i < n; i++) { - std::cin >> command; - if (command == "add") { - std::cin >> k; - bits |= (1<> k; - bits &= ~(1<> k; - if (bits & (1<> k; - bits ^= (1< Date: Thu, 28 Mar 2024 17:04:54 +0900 Subject: [PATCH 4/4] =?UTF-8?q?12=EC=B0=A8=EC=8B=9C=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YIM2UL2ET/README.md | 1 + ...2\354\260\250\354\213\234 - BOJ 11723.cpp" | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 "YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 170c23b..32219bb 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -13,4 +13,5 @@ | 09차시 | 2024.03.07 | 임의 정밀도 / 큰 수 연산 && 재귀 | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10차시 | 2024.03.10 | 스택 | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11차시 | 2024.03.18 | 스택 | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | +| 12차시 | 2024.03.28 | 비트마스킹 | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | --- diff --git "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" new file mode 100644 index 0000000..c7b96fd --- /dev/null +++ "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" @@ -0,0 +1,36 @@ +#include + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, bits = 0; + std::string command; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> command; + if (command == "add") { + std::cin >> k; + bits |= (1<> k; + bits &= ~(1<> k; + if (bits & (1<> k; + bits ^= (1<