VioletaBabel

11723번: 집합 본문

백준/백준-C++
11723번: 집합
Beabletoet 2017. 6. 14. 19:18

#include<cstdio>

#include<cstring>

bool s[21];

int main()

{

int m, x;

char com[7];

for (scanf("%d", &m); m--;)

{

scanf("%s", &com);

if (!strcmp("all", com))

for (int i = 1; i < 21; ++i)

s[i] = 1;

else if (!strcmp("empty", com))

for (int i = 1; i < 21; ++i)

s[i] = 0;

else

{

scanf("%d", &x);

if (!strcmp("add", com))

s[x] = 1;

else if (!strcmp("remove", com))

s[x] = 0;

else if (!strcmp("check", com))

printf("%d\n", s[x]);

else

s[x] = (s[x] == 1) ? 0 : 1;

}

}

}

'백준 > 백준-C++' 카테고리의 다른 글

10973번: 이전 순열  (0) 2017.06.14
10972번: 다음 순열  (0) 2017.06.14
1654번: 랜선 자르기  (0) 2017.06.14
11728번: 배열 합치기  (0) 2017.06.14
10610번: 30  (0) 2017.06.13
Comments