We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e91032 commit 02844bbCopy full SHA for 02844bb
Appendix C/11723_2.cpp
@@ -0,0 +1,40 @@
1
+// http://boj.kr/5d6d3f1b55a04ea2a5bab1e7b9e28684
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+
5
+int state;
6
7
+int main(){
8
+ ios::sync_with_stdio(0);
9
+ cin.tie(0);
10
11
+ int m;
12
+ cin >> m;
13
+ while(m--){
14
+ string com;
15
+ int x;
16
+ cin >> com;
17
+ if(com == "add"){
18
+ cin >> x;
19
+ state |= (1 << (x-1));
20
+ }
21
+ else if(com == "remove"){
22
23
+ state &= (~(1 << (x-1)));
24
25
+ else if(com == "check"){
26
27
+ cout << ((state >> (x-1)) & 1) << '\n';
28
29
+ else if(com == "toggle"){
30
31
+ state ^= (1 << (x-1));
32
33
+ else if(com == "all"){
34
+ state = 0xfffff;
35
36
+ else{ // empty
37
+ state = 0;
38
39
40
+}
0 commit comments