일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- NAV
- 16.04
- 백준
- 라즈베리파이3
- 라즈비안
- MongoDB
- raspberrypi
- springboot3.x
- 2909
- baekjun
- node.js
- dp
- Python
- 라즈베리파이
- 크롤링
- CSS
- Algorythm
- algotythm
- 13237
- nav-tab
- dynaminprogramming
- 트리
- HTML
- 파이썬
- Crawling
- 알고리즘
- 라즈베리파이3b+
- ubuntu
- bootstrap
- 2579
- Today
- Total
목록백준 (24)
노트
n = int(input()) tree = {} for _ in range(n): root, left, right = input().split() tree[root] = [left,right] def preorder(a): if a is not '.': print(a,end='') preorder(tree[a][0]) preorder(tree[a][1]) def inorder(a): if a is not '.': inorder(tree[a][0]) print(a,end='') inorder(tree[a][1]) def postorder(a): if a is not '.': postorder(tree[a][0]) postorder(tree[a][1]) print(a,end='') preorder('A') ..
n = int(input()) for i in range(n): floor = int(input()) room = int(input()) f0 = [i for i in range(1,room+1)] for j in range(floor): for k in range(1,room): f0[k] += f0[k - 1] print(f0[room-1])
from collections import deque def bfs(node): queue = deque() queue.append(node) while queue: node = queue.popleft() for n in friend[node]: if check[n] == 0: check[n] = check[node]+1 queue.append(n) n = int(input()) m = int(input()) friend = [[] for _ in range(n+1)] for j in range(m): a,b=map(int,input().split(' ')) friend[a].append(b) friend[b].append(a) check = [0]*(n+1) check[1] = 1 bfs(1) res..
n = int(input()) answer = 0 in_, out = dict(), [] for i in range(n): car = input() in_[car] = i for _ in range(n): car = input() out.append(car) for i in range(n - 1): for j in range(i + 1, n): if in_[out[i]] > in_[out[j]]: answer += 1 break print(answer)
3번이나 틀렸다고 나와서 뭐지 했는데 아이패드로 풀어서 예제 복사할때 줄바꿈이 안됐던거였다.. 데탑으로 푸니 잘됨 q = [] while True: s = input() if s=='.': break for i in range(len(s)): if s[i] == '.': if len(q) == 0: print('yes') else: print('no') q = [] continue if s[i] == '(' or s[i] == ')' or s[i] == '[' or s[i] == ']': q.append(s[i]) if len(q) > 0: if s[i] == ')' and q[len(q) - 2] == '(': q.pop() q.pop() if s[i] == ']' and q[len(q) - 2] ==..
v = int(input()) e = int(input()) graph = [[] for _ in range(v+1)] for _ in range(e): a, b = map(int, input().split()) graph[a].append(b) graph[b].append(a) def dfs(x): global count visited[x] = True count += 1 for node in graph[x]: if visited[node]: continue dfs(node) count = 0 visited = [False for _ in range(v+1)] dfs(1) print(count-1)
n = int(input()) a,b = map(int,input().split()) m = int(input()) relation = [[0]*101 for _ in range(101)] visited = [0]*101 q = [] for i in range(m): x,y = map(int,input().split()) relation[x][y]=relation[y][x]=1 def dfs(): visited[a]=1 q.append(a) while q: k = q.pop(0) if k==b: return for j in range(1,n+1): if relation[k][j]==1 and visited[j]==0: visited[j]=visited[k]+1 q.append(j) dfs() if vis..
n, k = map(int, input().split()) kit = list(map(int, input().split())) used = [0] * n ans = 0 def dfs(a, weight): global ans if weight = n: ans += 1 return for i in range(n): if used[i] == 0: used[i] = 1 dfs(a + 1, weight + kit[i] - k) used[i] = 0 dfs(0, 500) print(ans)