-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11723.cpp
More file actions
76 lines (65 loc) · 1.27 KB
/
11723.cpp
File metadata and controls
76 lines (65 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// 11723.cpp
// algo
//
// Created by 박효정 on 2021/06/27.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int s[21];
int main(){
cin.tie(0);
cout.tie(0);
std::ios::sync_with_stdio(false);
int m;
cin>>m;
while(m--){
string str;
int tmp=0;
cin>>str;
if(str!="all"&&str!="empty"){
cin>>tmp;
}
if(str=="add"){
if(s[tmp]==0){
s[tmp]=1;
}
}
else if(str=="remove"){
if(s[tmp]==1){
s[tmp]=0;
}
}
else if(str=="check"){
if(s[tmp]==1){
cout<<1<<"\n";
}
else{
cout<<0<<"\n";
}
}
else if(str=="toggle"){
if(s[tmp]==1){
s[tmp]=0;
}
else{
s[tmp]=1;
}
}
else if(str=="all"){
for(int i=1;i<=20;i++){
s[i]=1;
}
}
else if(str=="empty"){
for(int i=1;i<=20;i++){
s[i]=0;
}
}
}
return 0;
}