| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- deque
- python3
- c#
- 합 구하기
- Java
- unity
- 브루투포스
- BFS
- pypy3
- 소수판별
- JPA
- 소수찾기
- popleft
- 인프런
- 1일1솔
- spring
- DP
- 프로그래머스
- Python
- 우선순위큐
- appendleft
- 파이썬
- 연관관계
- 그리디 알고리즘
- 누적합
- C#강의
- 백준
- 완전탐색
- LCM
- mvc
Archives
- Today
- Total
jae_coding
(백준 자료구조 문제풀이) 9012번 괄호 본문
반응형
문제
코드
import sys
input = sys.stdin.readline
T = int(input())
def VPS(inp_str):
result = 0
for i in inp_str:
if i == '(':
result += 1
elif i == ')':
result -= 1
if result < 0:
break
return result
for _ in range(T):
inp_str = list(input().strip())
ans = VPS(inp_str)
if ans == 0:
print("YES")
else:
print("NO")반응형
'알고리즘 문제 > 자료구조 문제' 카테고리의 다른 글
| (백준 자료구조 문제풀이) 1874번 스택 수열 (0) | 2022.07.19 |
|---|---|
| (백준 자료구조 문제풀이) 10866번 덱 (0) | 2022.07.18 |
| (백준 자료구조 문제풀이) 1158번 요세푸스 문제 (0) | 2022.07.18 |
| (백준 알고리즘 문제풀이) 18258번 큐 2 (0) | 2022.07.18 |
| (백준 자료구조 문제풀이) 10828번 스택 (0) | 2022.07.18 |
Comments