일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- node.js
- 파이썬
- ubuntu
- springboot3.x
- dynaminprogramming
- CSS
- 라즈베리파이3b+
- 라즈베리파이
- algotythm
- 2579
- 라즈베리파이3
- 16.04
- NAV
- dp
- 백준
- nav-tab
- baekjun
- raspberrypi
- 라즈비안
- HTML
- 13237
- bootstrap
- Algorythm
- 트리
- 2909
- 알고리즘
- 크롤링
- Crawling
- Python
- MongoDB
- Today
- Total
목록Algorythm (15)
노트
n = int(input()) parent = [int(input()) for _ in range(n)] high = [0 for i in range(n)] for i in range(n): if parent[i]==-1: continue high[i]=high[parent[i]-1]+1 for i in range(n): print(high[i])
c, zero = map(int, input().split()) money = int(str(1)+ "0"*zero) m = c//money n = c % money if zero==0: print(c) else: if n >= money//2: price = money*(m+1) else: price = money*m print(price)
import sys sys.setrecursionlimit(10 ** 6) n,m = map(int,sys.stdin.readline().split()) array = [list(map(int,sys.stdin.readline().strip())) for _ in range(n)] visted = [[False]*m for _ in range(n)] d = [[1,0],[0,1],[-1,0],[0,-1]] def dfs(r,c): global flag if r>=n: flag=True if 0
n=int(input()) bot=[] cur=0 for i in range(n): a, b=map(int, input().split()) bot.append([a, b]) cur+=bot[0][1] i=1 while i=bot[i][1]: i+=1 else: cur+=(bot[i][1]-cur%(bot[i][0]+bot[i][1])-1) print(cur+1)
n=int(input()) s=[int(input()) for _ in range(n)] dp=[0]*n if len(s)
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,m = map(int,input().split()) cards = list(map(int,input().split())) ans = 0 for i in range(m): cards.sort() temp = cards[0]+cards[1] cards[0] = cards[1] = temp for j in range(n): ans += cards[j] print(ans)