일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 13237
- 트리
- bootstrap
- HTML
- 라즈베리파이3
- raspberrypi
- algotythm
- 알고리즘
- 2579
- 2909
- Crawling
- Python
- 백준
- node.js
- ubuntu
- MongoDB
- 라즈비안
- CSS
- Algorythm
- 라즈베리파이3b+
- 라즈베리파이
- springboot3.x
- 크롤링
- 파이썬
- NAV
- nav-tab
- dynaminprogramming
- dp
- baekjun
- 16.04
- Today
- Total
목록알고리즘 (33)
노트
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)
import sys sys.setrecursionlimit(10 ** 6) a,b = map(int,input().split()) boss = list(map(int,input().split())) gujo = [[] for _ in range(a)] my_boss = [0]*(a+1) ans = [0]*(a+1) for i in range(1,a): if boss[i]!=-1: gujo[boss[i]].append(i+1) my_boss[i+1]=boss[i] def tamsaek(k): ans[k] += ans[my_boss[k]] if k
n = int(input()) ans = 0 for _ in range(n): a = int(input()) ans+=a print(ans) 그냥 덧셈문제,,
n = int(input()) s = input() ans = 'NO' for i in range(1,n): a = s[:i] b = s[n-i:] cnt=0 for j in range(len(a)): if a[j]!=b[j]: cnt+=1 if cnt==1: ans='YES' break print(ans)
자꾸 시간초과가 나서 readline 추가 import sys input = sys.stdin.readline n = int(input()) hw = [] final_score = 0 idx = 0 for _ in range(n): line = list(map(int,input().split())) if line[0]==1: if line[2]-1==0: final_score += line[1] else: hw.append([line[1],line[2]-1]) idx += 1 else: if len(hw)>0: hw[idx-1][1] -= 1 if hw[idx-1][1]==0: score, time = hw.pop() final_score+=score idx -= 1 print(final_score)
word = input() alpha = ['c=','c-','dz=','d-','lj','nj','s=','z='] for j in alpha: word = word.replace(j, '@') print(len(word))
n = int(input()) line = list(map(int,input().split())) passed = [] stack = [] number = 1 while line: temp = line.pop(0) if temp==number: passed.append(temp) number+=1 else: stack.insert(0,temp) while stack: num = stack.pop(0) if len(stack)+1>=0 and num==number: passed.append(num) number+=1 else: stack.insert(0,num) break if not stack: print("Nice") else: print("Sad")