일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 코테
- 코틀린
- Python
- 뒤로가기
- 최소공배수
- 매일11시
- 안드로이드
- 파이썬
- lcm
- 순열
- 괄호
- 앱
- 나머지
- Kotlin
- 1260
- permutation
- 6603
- Combination
- itertools
- expo
- LCS
- 백준
- 11기
- 11057
- 11054
- 11053
- Android
- 1182
- 9095
- 홈화면
Archives
- Today
- Total
황소개발자
백준 11723 파이썬 python : 집합 @@황소처럼 우직하게@@ 본문
반응형
import sys
input = sys.stdin.readline
S = []
def do(order, num):
global S
if order == 'add':
if num not in S:
S.append(num)
elif order == 'remove':
if num in S:
S.remove(num)
elif order == 'check':
if num in S:
print(1)
else:
print(0)
elif order == 'toggle':
if num in S:
S.remove(num)
else:
S.append(num)
elif order == 'all':
S = [i for i in range(1, 21)]
elif order == 'empty':
S = []
n = int(input())
for i in range(n):
s = input().strip()
if s == 'all' or s == 'empty':
do(s, 0)
continue
s = s.split()
do(s[0], int(s[1]))
반응형
'백준 문제 풀이' 카테고리의 다른 글
백준 15650 파이썬 python : N과 M (2) @@황소처럼 우직하게@@ 아아 (0) | 2020.03.01 |
---|---|
백준 15649 파이썬 python : N과 M (1) @@황소처럼 우직하게@@ 숏코딩 (0) | 2020.03.01 |
백준 14501 파이썬 python : 퇴사 @@황소처럼 우직하게@@ 재귀로 간단구현 (10) | 2020.02.28 |
백준 1182 파이썬 python : 부분수열의 합 @@황소처럼 우직하게@@ (0) | 2020.02.28 |
백준 1759 파이썬 python : 암호 만들기 @@황소처럼 우직하게@@ 코로나 조심하세요 (0) | 2020.02.28 |
Comments