Skip to content

Commit

Permalink
Create 11723_1.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
encrypted-def committed Mar 17, 2024
1 parent 2cdcc3f commit 11db16d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Appendix C/11723_1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// http://boj.kr/1febea8e97bb4493925075f36d6efb8d
#include <bits/stdc++.h>
using namespace std;

int chk[20];

int main(){
ios::sync_with_stdio(0);
cin.tie(0);

int m;
cin >> m;
while(m--){
string com;
int x;
cin >> com;
if(com == "add"){
cin >> x;
chk[x-1] = 1;
}
else if(com == "remove"){
cin >> x;
chk[x-1] = 0;
}
else if(com == "check"){
cin >> x;
cout << chk[x-1] << '\n';
}
else if(com == "toggle"){
cin >> x;
chk[x-1] = 1 ^ chk[x-1];
}
else if(com == "all"){
fill(chk, chk+20, 1);
}
else{ // empty
fill(chk, chk+20, 0);
}
}
}

0 comments on commit 11db16d

Please sign in to comment.