[백준 바킹독] 0x09 - BFS 토마토(7576)
Introduction
스택을 구현하고 사용해 봅시다.
https://www.acmicpc.net/step/11
주어진 문자열이 올바른 괄호열인지 판단하는 문제
아래는 스택으로 풀지 않았다.
import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
strings = input().rstrip()
cnt = 0
error = False
for s in strings:
if s == '(':
cnt += 1
elif s == ')':
cnt -= 1
if cnt < 0:
error = True
break
if error == True:
print("NO")
else:
if cnt != 0:
print("NO")
else:
print("YES")
위와 같은데 괄호의 종류가 다양해진 문제
import sys
input = sys.stdin.readline
strings = input().rstrip()
while strings != '.':
check_stack = []
error = False
for s in strings:
if s == '(' or s == '[':
check_stack.append(s)
elif s == ')':
if len(check_stack) > 0:
check = check_stack.pop()
if check != '(':
error = True
break
else:
error = True
break
elif s == ']':
if len(check_stack) > 0:
check = check_stack.pop()
if check != '[':
error = True
break
else:
error = True
break
if error == True:
print("no")
else:
if len(check_stack) == 0:
print("yes")
else:
print("no")
strings = input().rstrip()
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
1167 트리의 지름
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Git 명령어를 사용한 하위 디렉토리 다운로드 Clone 할 로컬 저장소 생성
Introduction
# Fetch the submodule commits into the main repository git remote add submodule_origin git://url/to/submodule/origin git fetch submodule_origin
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Graph
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Introduction
Spring Project
the page for java
가벼운 Base image를 사용
version: 3.0.0a10
WIDTH
version: 3.0.0a10
#include <iostream> #include <thread> #include <chrono> #include <mutex> #include <atomic> #include <string.h>
version: 3.0.0a10
https://cplusplus.com/reference/future/
Multithreading support was introduced in C++11.
how to costom github blog using jekyll
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different wa...