Skip to content

Commit

Permalink
12차시 업로드
Browse files Browse the repository at this point in the history
  • Loading branch information
YIM2UL2ET committed Mar 28, 2024
1 parent 3131c76 commit 3a9d7c8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
---
36 changes: 36 additions & 0 deletions YIM2UL2ET/비트마스킹/12차시 - BOJ 11723.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <iostream>

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);
}
else if (command == "remove") {
std::cin >> k;
bits &= ~(1<<k);
}
else if (command == "check") {
std::cin >> k;
if (bits & (1<<k)) std::cout << "1\n";
else std::cout << "0\n";
}
else if (command == "toggle") {
std::cin >> k;
bits ^= (1<<k);
}
else if (command == "all") bits = (1<<21)-1;
else bits = 0;
}
return 0;
}

0 comments on commit 3a9d7c8

Please sign in to comment.