전체 글202 백준 11866 요세푸스 문제 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 from collections import deque n, k = map(int, input().split()) queue = deque() li = [] for i in range(n): queue.append(i + 1) print('') cs 2020. 10. 25. 백준 2164 카드2(큐) 1 2 3 4 5 6 7 8 9 10 11 12 13 import sys from collections import deque n = int(sys.stdin.readline()) queue = deque() for i in range(n): queue.append(i+1) while len(queue) > 1: queue.popleft() queue.append(queue.popleft()) print(queue.popleft) Colored by Color Scripter cs 2020. 10. 25. 백준 1874 스택 수열 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 n = int(input()) s = [] op = [] count = 1 temp = True for i in range(n): num = int(input()) while count 2020. 10. 25. 백준 4949 균형잡힌 세상 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 while True: s = input() if s == '.': break stack = [] temp = True for i in s : if i == '(' or i == '[': stack.append(i) elif i == ')': if not stack or stack[-1] == '[': temp = False break elif stack[-1] == '(': stack.pop() elif i == ']': if not stack or stack[-1] == '(': temp = False break elif stack[-1] == '[': stack.pop() if .. 2020. 10. 25. 백준 9012 괄호 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 a = int(input()) for i in range(a): b = input() s = list(b) sum = 0 for i in s: if i == '(': sum += 1 elif i ==')': sum -= 1 if sum0: print('NO') elif sum == 0: print('YES') cs 2020. 10. 25. 백준 10773 제로 1 2 3 4 5 6 7 8 9 10 11 12 13 n = int(input()) nums = [] for _ in range(n): a = int(input()) if a == 0 and len(nums) != 0: nums.pop() elif a==0 and len(nums) ==0 : continue else : nums.append(a) print(sum(nums)) cs 2020. 10. 25. 이전 1 ··· 12 13 14 15 16 17 18 ··· 34 다음