일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 11기
- 11057
- 파이썬
- 앱
- 홈화면
- 9095
- Kotlin
- Android
- 최소공배수
- 나머지
- LCS
- Python
- 코테
- 코틀린
- 순열
- 1260
- 6603
- lcm
- 11054
- Combination
- 백준
- 뒤로가기
- 매일11시
- permutation
- itertools
- 안드로이드
- 괄호
- expo
- 11053
- 1182
- Today
- Total
목록괄호 (2)
황소개발자
올바른 괄호가 되기위해서는 ( * * * * ) * * * * * * 이런식. 이 때, 첫번째 괄호를 1번째, 두번째 괄호를 k 번째라고하자. 그러면 괄호안에 쌓여진 공간의 개수는 k - 2 이고, 오른쪽에 공간의 개수는 n - k 개이다. dp[n] = dp[k - 2] * dp[n - k] (k = 2 ~ n) 이다. import sys input = sys.stdin.readline t = int(input()) lst = [] for _ in range(t): lst.append(int(input())) dp = [0] * 5001 dp[0] = 1 for i in range(2, 5001, 2): for j in range(2, i + 1, 2): dp[i] += (dp[j - 2] * dp[i..

import sys input = sys.stdin.readline brackets = input().strip() def check_brakcets(ss): stack = [] for s in ss: if s == '(' or s == '[': stack.append(s) elif s == ')' and stack: if stack[-1] == '(': stack = stack[:-1] else: stack.append(s) elif s == ']' and stack: if stack[-1] == '[': stack = stack[:-1] else: stack.append(s) else: stack.append(s) if stack: return False else: return True def sol..